From: Chris Fulljames Date: Fri, 14 Feb 2025 12:33:38 +0000 (-0500) Subject: More work on playlist UI X-Git-Url: https://littlesong.place/gitweb/gitweb.cgi?a=commitdiff_plain;h=e7480e657dcd7d50f6f5b908e66cf12fd1fa4093;p=littlesongplace.git More work on playlist UI --- diff --git a/main.py b/main.py index 0f2f5cd..9c9f1b0 100644 --- a/main.py +++ b/main.py @@ -738,12 +738,17 @@ def delete_playlist(playlistid): flash_and_log(f"Deleted playlist {plist_data['name']}", "success") return redirect(request.referrer) -@app.post("/append-to-playlist/") -def append_to_playlist(playlistid): +@app.post("/append-to-playlist") +def append_to_playlist(): if not "userid" in session: abort(401) # Make sure playlist exists + try: + playlistid = int(request.form["playlistid"]) + except ValueError: + abort(400) + plist_data = query_db("select * from playlists where playlistid = ?", args=[playlistid]) if not plist_data: abort(404) @@ -752,7 +757,7 @@ def append_to_playlist(playlistid): if session["userid"] != plist_data["userid"]: abort(401) - songid = request.args["songid"] + songid = request.form["songid"] # Make sure song exists song_data = query_db("select * from songs where songid = ?", args=[songid]) diff --git a/templates/song-list.html b/templates/song-list.html index 0aa815f..168721f 100644 --- a/templates/song-list.html +++ b/templates/song-list.html @@ -149,10 +149,20 @@ {% endfor %} + {% if playlists -%} + {%- endif %} diff --git a/todo.txt b/todo.txt index 16eded9..3978017 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,13 @@ NOW -- Apply user colors to songs in lists outside profile +- Playlists: + - Create + - Play + - Remove song + - Reorder songs + - Delete + - Pin to profile + - Albums? +- Show upload date in song list SOON - Player minimize button @@ -11,14 +19,6 @@ SOON - Remove songs - Reorder songs - Automatically use songs on page when queue ends -- Playlists: - - Create - - Play - - Remove song - - Reorder songs - - Delete - - Pin to profile - - Albums? LATER - Show song info for song in player (description, tags)