From: Chris Fulljames Date: Sat, 21 Feb 2026 17:17:18 +0000 (-0500) Subject: Add wave download button X-Git-Url: https://littlesong.place/gitweb/?a=commitdiff_plain;h=73eb64b561afeaa6b445961cdbf7df91d4cf322a;p=littlesongplace.git Add wave download button --- diff --git a/src/littlesongplace/songs.py b/src/littlesongplace/songs.py index 60710ff..59128d6 100644 --- a/src/littlesongplace/songs.py +++ b/src/littlesongplace/songs.py @@ -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: diff --git a/src/littlesongplace/templates/song.html b/src/littlesongplace/templates/song.html index 85a4983..86b1ef2 100644 --- a/src/littlesongplace/templates/song.html +++ b/src/littlesongplace/templates/song.html @@ -23,8 +23,11 @@ {% if session["userid"] == song.userid -%} - - +

+Download .mp3
+{%- if song.has_wave() %} +Download .wav +{%- endif %} {%- endif %}