Lyrics added
This commit is contained in:
parent
0031f38b74
commit
0a519ee804
1 changed files with 11 additions and 8 deletions
|
@ -43,20 +43,23 @@ def musicstatus():
|
|||
history.append(currentbeforereset)
|
||||
html += f'<h2>Currently Playing: {history[-1][0]}</h2>\n'
|
||||
html += f'<h2>Last Update Time: {datetime.datetime.fromtimestamp(int(history[-1][1]), datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S")} (UTC +0)</h2>\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 += '<h2>Lyrics:</h2>\n'
|
||||
html += '<p style="white-space: pre-wrap;">\n'
|
||||
if lyrics[i].startswith("["):
|
||||
if ":" in lyrics[i][1:3]:
|
||||
lyrics.pop(i)
|
||||
else:
|
||||
lyrics[i] = lyrics[i][10:]
|
||||
html += '<h3>Lyrics:</h3>\n'
|
||||
html += '<div style="border: 1px solid #ffffff; padding: 10px; text-align: center;">\n'
|
||||
for lyric in lyrics:
|
||||
html += lyric + "\n"
|
||||
html += '</p>\n'
|
||||
html += f'<p>{lyric}</p>\n'
|
||||
html += '</div>\n'
|
||||
html += '<table style="width: 100%; border-collapse: collapse;">\n<tr>\n<th style="border: 1px solid #ffffff; padding: 10px;">Music Name</th>\n<th style="border: 1px solid #ffffff; padding: 10px;">Time</th>\n</tr>\n'
|
||||
for music in history[::-1]:
|
||||
html += '<tr>\n<td style="border: 1px solid #ffffff; padding: 10px;">' + music[0] + '</td>\n<td style="border: 1px solid #ffffff; padding: 10px;">' + datetime.datetime.fromtimestamp(int(music[1]), datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S") + '</td>\n</tr>\n'
|
||||
|
|
Loading…
Reference in a new issue