Lyrics added
This commit is contained in:
parent
69d7c844a3
commit
0031f38b74
1 changed files with 12 additions and 1 deletions
|
@ -45,7 +45,18 @@ def musicstatus():
|
|||
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:
|
||||
html += f'<h2>Lyrics:</h2>\n<p>{f.read()}</p>\n'
|
||||
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'
|
||||
for lyric in lyrics:
|
||||
html += lyric + "\n"
|
||||
html += '</p>\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…
Add table
Reference in a new issue