feat: add per-song MP3 download buttons to admin request page

Adds an admin download route (/admin/request/<rid>/download-song/<version>)
and Download buttons next to Version A and Version B in section 2 (Songs),
shown only when the MP3 exists on disk. Bumps version to 0.9.2.
This commit is contained in:
Troll (Hermes Agent) 2026-09-20 02:49:01 +00:00
parent 530451cfef
commit be85a88543
5 changed files with 34 additions and 3 deletions

18
app.py
View file

@ -922,6 +922,24 @@ def admin_download_stems(rid):
return send_file(buf, mimetype='application/zip', as_attachment=True, download_name=download_name)
@app.route('/admin/request/<int:rid>/download-song/<version>')
def admin_download_song(rid, version):
"""Download a single song MP3 (Version A or B) for a request."""
redir = require_admin()
if redir:
return redir
req = get_request_by_id(rid)
if not req:
abort(404)
if version not in ('a', 'b'):
abort(404)
path = req.get('song_a_path') if version == 'a' else req.get('song_b_path')
if not path or not Path(path).exists():
flash('Song file not found.', 'error')
return redirect(url_for('admin_request', rid=rid))
return send_file(path, as_attachment=True, download_name=Path(path).name)
# ---------------------------------------------------------------------------
# Admin routes
# ---------------------------------------------------------------------------