mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
rename legacy endpoint
This commit is contained in:
+4
-4
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user