]> littlesong.place Git - littlesongplace.git/commitdiff
Fix download-wav action
authorChris Fulljames <christianfulljames@gmail.com>
Sat, 21 Feb 2026 17:19:26 +0000 (12:19 -0500)
committerChris Fulljames <christianfulljames@gmail.com>
Sat, 21 Feb 2026 17:19:26 +0000 (12:19 -0500)
src/littlesongplace/songs.py

index 59128d6f27b884603403c671bdee082afe283b62..62b17b22bfc29bb6cbcdc2f3f4ebe47e6ff4725c 100644 (file)
@@ -555,7 +555,7 @@ def delete_song(songid):
 @bp.get("/song/<int:userid>/<int:songid>")
 def song(userid, songid):
     action = request.args.get("action", None)
-    if action in ["view", "download"]:
+    if action in ["view", "download", "download-wav"]:
         try:
             song = by_id(songid)
             if song.userid != userid:
@@ -567,9 +567,15 @@ def song(userid, songid):
                         songs=[song],
                         song=song,
                         **users.get_user_colors(userid))
-            else:  # download
+
+            elif action == "download":
                 return send_from_directory(
                     datadir.get_user_songs_path(userid), str(songid) + ".mp3", as_attachment=True, download_name=song.title + ".mp3")
+
+            elif action == "download-wav":
+                return send_from_directory(
+                    datadir.get_user_songs_path(userid)/"waves", str(songid) + ".wav", as_attachment=True, download_name=song.title + ".wav")
+
         except ValueError:
             abort(404)
     else: