From 0a519ee804eb22f982a7ab0b3636a4c301184e33 Mon Sep 17 00:00:00 2001 From: Halhadus Date: Sun, 22 Dec 2024 16:21:57 +0300 Subject: [PATCH] Lyrics added --- websitepart.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/websitepart.py b/websitepart.py index 8513897..305748e 100644 --- a/websitepart.py +++ b/websitepart.py @@ -43,20 +43,23 @@ def musicstatus(): history.append(currentbeforereset) html += f'

Currently Playing: {history[-1][0]}

\n' html += f'

Last Update Time: {datetime.datetime.fromtimestamp(int(history[-1][1]), datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S")} (UTC +0)

\n' - if os.path.exists("lyrics/" + history[-1][0] + ".txt"): - with open("lyrics/" + history[-1][0] + ".txt", "r") as f: + if os.path.exists("lyrics/" + history[-1][0] + ".lrc"): + with open("lyrics/" + history[-1][0] + ".lrc", "r") as f: lyrics = f.read().split("\n") for i in range(len(lyrics)): if lyrics[i] == "": lyrics.pop(i) for i in range(len(lyrics)): - if i.startswith("["): - lyrics[i] = lyrics[i][10:] - html += '

Lyrics:

\n' - html += '

\n' + if lyrics[i].startswith("["): + if ":" in lyrics[i][1:3]: + lyrics.pop(i) + else: + lyrics[i] = lyrics[i][10:] + html += '

Lyrics:

\n' + html += '
\n' for lyric in lyrics: - html += lyric + "\n" - html += '

\n' + html += f'

{lyric}

\n' + html += '
\n' html += '\n\n\n\n\n' for music in history[::-1]: html += '\n\n\n\n'
Music NameTime
' + music[0] + '' + datetime.datetime.fromtimestamp(int(music[1]), datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S") + '