]> littlesong.place Git - littlesongplace.git/commitdiff
Add wave download button
authorChris Fulljames <christianfulljames@gmail.com>
Sat, 21 Feb 2026 17:17:18 +0000 (12:17 -0500)
committerChris Fulljames <christianfulljames@gmail.com>
Sat, 21 Feb 2026 17:17:18 +0000 (12:17 -0500)
src/littlesongplace/songs.py
src/littlesongplace/templates/song.html

index 60710ffc268e41048b0f9a4c5aee88336d519db4..59128d6f27b884603403c671bdee082afe283b62 100644 (file)
@@ -55,6 +55,11 @@ class Song:
             [self.queueid])
         return len(preceding_items) + 1
 
+    def has_wave(self):
+        user_songs_path = datadir.get_user_songs_path(self.userid)
+        filepath = user_songs_path / "waves" / (str(self.songid) + ".wav")
+        return filepath.exists()
+
 def by_id(songid):
     songs = _from_db("SELECT * FROM songs_view WHERE songid = ?", [songid])
     if not songs:
index 85a4983c90b29dfac849bbb85f8c94ffb326a8e9..86b1ef2e209d9b0c57bf06f58b4085ab77327c96 100644 (file)
 </span>
 {% if session["userid"] == song.userid -%}
 <a href="/edit-song?songid={{ song.songid }}" class="song-list-button" title="Edit"><img class="lsp_btn_edit02" /></a>
-<a href="/delete-song/{{ song.songid }}" class="song-list-button" onclick="return confirm('Are you sure you want to delete this song?')" title="Delete"><img class="lsp_btn_delete02" /></a>
-<a href="/song/{{ song.userid }}/{{ song.songid }}?action=download" class="song-list-button" download="{{ song.title }}.mp3" title="Download mp3 File"><img class="lsp_btn_download02" /></a>
+<a href="/delete-song/{{ song.songid }}" class="song-list-button" onclick="return confirm('Are you sure you want to delete this song?')" title="Delete"><img class="lsp_btn_delete02" /></a><br/><br/>
+<a href="/song/{{ song.userid }}/{{ song.songid }}?action=download" class="song-list-button" download="{{ song.title }}.mp3" title="Download mp3 File"><img class="lsp_btn_download02" />Download .mp3</a><br/>
+{%- if song.has_wave() %}
+<a href="/song/{{ song.userid }}/{{ song.songid }}?action=download-wav" class="song-list-button" download="{{ song.title }}.wav" title="Download wav File"><img class="lsp_btn_download02" />Download .wav</a>
+{%- endif %}
 {%- endif %}
 </p>