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)
|
history.append(currentbeforereset)
|
||||||
html += f'<h2>Currently Playing: {history[-1][0]}</h2>\n'
|
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'
|
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"):
|
if os.path.exists("lyrics/" + history[-1][0] + ".lrc"):
|
||||||
with open("lyrics/" + history[-1][0] + ".txt", "r") as f:
|
with open("lyrics/" + history[-1][0] + ".lrc", "r") as f:
|
||||||
lyrics = f.read().split("\n")
|
lyrics = f.read().split("\n")
|
||||||
for i in range(len(lyrics)):
|
for i in range(len(lyrics)):
|
||||||
if lyrics[i] == "":
|
if lyrics[i] == "":
|
||||||
lyrics.pop(i)
|
lyrics.pop(i)
|
||||||
for i in range(len(lyrics)):
|
for i in range(len(lyrics)):
|
||||||
if i.startswith("["):
|
if lyrics[i].startswith("["):
|
||||||
lyrics[i] = lyrics[i][10:]
|
if ":" in lyrics[i][1:3]:
|
||||||
html += '<h2>Lyrics:</h2>\n'
|
lyrics.pop(i)
|
||||||
html += '<p style="white-space: pre-wrap;">\n'
|
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:
|
for lyric in lyrics:
|
||||||
html += lyric + "\n"
|
html += f'<p>{lyric}</p>\n'
|
||||||
html += '</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'
|
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]:
|
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'
|
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