add the albumhash prop to the fallback track object

- plus other tiny changes
This commit is contained in:
geoffrey45
2022-07-05 14:22:00 +03:00
committed by Mungai Geoffrey
parent 6fbf179f34
commit 40fcbfd576
6 changed files with 18 additions and 59 deletions
+6 -2
View File
@@ -17,14 +17,18 @@ def send_track_file(trackid):
Returns an audio file that matches the passed id to the client.
"""
track = instances.tracks_instance.get_track_by_id(trackid)
msg = {"msg": "File Not Found"}
if track is None:
return "File not found", 404
return msg, 404
track = models.Track(track)
type = track.filepath.split(".")[-1]
return send_file(track.filepath, mimetype=f"audio/{type}")
try:
return send_file(track.filepath, mimetype=f"audio/{type}")
except FileNotFoundError:
return msg, 404
@track_bp.route("/sample")