rename legacy endpoint

This commit is contained in:
cwilvx
2024-06-19 14:57:47 +03:00
parent acac50c932
commit ae4dc77bba
+4 -4
View File
@@ -23,8 +23,8 @@ class SendTrackFileQuery(BaseModel):
) )
@api.get("/<trackhash>/classic") @api.get("/<trackhash>/legacy")
def send_track_file_classic(path: TrackHashSchema, query: SendTrackFileQuery): def send_track_file_legacy(path: TrackHashSchema, query: SendTrackFileQuery):
""" """
Get a playable audio file without Range support Get a playable audio file without Range support
@@ -49,7 +49,7 @@ def send_track_file_classic(path: TrackHashSchema, query: SendTrackFileQuery):
if track_exists: if track_exists:
audio_type = get_mime(filepath) audio_type = get_mime(filepath)
return send_file(filepath, mimetype=audio_type) return send_file(filepath, mimetype=audio_type, conditional=True)
# Else, find file by trackhash # Else, find file by trackhash
tracks = TrackStore.get_tracks_by_trackhashes([trackhash]) tracks = TrackStore.get_tracks_by_trackhashes([trackhash])
@@ -61,7 +61,7 @@ def send_track_file_classic(path: TrackHashSchema, query: SendTrackFileQuery):
audio_type = get_mime(track.filepath) audio_type = get_mime(track.filepath)
try: try:
return send_file(track.filepath, mimetype=audio_type) return send_file(track.filepath, mimetype=audio_type, conditional=True)
except (FileNotFoundError, OSError) as e: except (FileNotFoundError, OSError) as e:
return msg, 404 return msg, 404