From 95099576440f95219a3968e76d2362f415d3f6fc Mon Sep 17 00:00:00 2001 From: Chris Fulljames Date: Sun, 16 Feb 2025 08:54:38 -0500 Subject: [PATCH] Add upload date to song list --- main.py | 4 +++- templates/song-list.html | 4 ++++ todo.txt | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index d848c8f..488fd02 100644 --- a/main.py +++ b/main.py @@ -989,6 +989,7 @@ class Song: username: str title: str description: str + created: str tags: list[str] collaborators: list[str] @@ -1056,7 +1057,8 @@ class Song: for sd in songs_data: song_tags = [t["tag"] for t in tags[sd["songid"]]] song_collabs = [c["name"] for c in collabs[sd["songid"]]] - songs.append(cls(sd["songid"], sd["userid"], sd["username"], sd["title"], sanitize_user_text(sd["description"]), song_tags, song_collabs)) + created = datetime.fromisoformat(sd["created"]).astimezone().strftime("%Y-%m-%d") + songs.append(cls(sd["songid"], sd["userid"], sd["username"], sd["title"], sanitize_user_text(sd["description"]), created, song_tags, song_collabs)) return songs diff --git a/templates/song-list.html b/templates/song-list.html index 829176f..b822f55 100644 --- a/templates/song-list.html +++ b/templates/song-list.html @@ -82,6 +82,10 @@ {% endfor %} +
+ Uploaded {{ song.created }} +
+
Comments:
diff --git a/todo.txt b/todo.txt index a1da407..cfcd4a3 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,5 @@ NOW - Test playlist API -- Show upload date in song list SOON - 10s skip forwards/backwards with left/right arrow keys -- 2.39.5