mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
try: use bjoern wsgi
This commit is contained in:
@@ -32,12 +32,10 @@ api = APIBlueprint("album", __name__, url_prefix="/album", abp_tags=[bp_tag])
|
||||
class GetAlbumVersionsBody(BaseModel):
|
||||
og_album_title: str = Field(
|
||||
description="The original album title (album.og_title)",
|
||||
example=Defaults.API_ALBUMNAME,
|
||||
)
|
||||
|
||||
albumhash: str = Field(
|
||||
description="The album hash of the album to exclude from the results.",
|
||||
example=Defaults.API_ALBUMHASH,
|
||||
)
|
||||
|
||||
|
||||
@@ -48,8 +46,6 @@ class GetMoreFromArtistsBody(AlbumLimitSchema):
|
||||
|
||||
base_title: str = Field(
|
||||
description="The base title of the album to exclude from the results.",
|
||||
example=Defaults.API_ALBUMNAME,
|
||||
default=None,
|
||||
)
|
||||
|
||||
|
||||
|
||||
+4
-7
@@ -15,10 +15,7 @@ api = APIBlueprint("lyrics", __name__, url_prefix="/lyrics", abp_tags=[bp_tag])
|
||||
|
||||
|
||||
class SendLyricsBody(TrackHashSchema):
|
||||
filepath: str = Field(
|
||||
description="The path to the file",
|
||||
example="/path/to/file.mp3",
|
||||
)
|
||||
filepath: str = Field(description="The path to the file")
|
||||
|
||||
|
||||
@api.post("")
|
||||
@@ -30,13 +27,13 @@ def send_lyrics(body: SendLyricsBody):
|
||||
trackhash = body.trackhash
|
||||
|
||||
is_synced = True
|
||||
lyrics, copyright = get_lyrics(filepath)
|
||||
lyrics, copyright = get_lyrics(filepath, trackhash)
|
||||
|
||||
if not lyrics:
|
||||
lyrics, copyright = get_lyrics_from_duplicates(trackhash, filepath)
|
||||
|
||||
if not lyrics:
|
||||
lyrics, is_synced, copyright = get_lyrics_from_tags(filepath)
|
||||
lyrics, is_synced, copyright = get_lyrics_from_tags(trackhash) # type: ignore
|
||||
|
||||
if not lyrics:
|
||||
return {"error": "No lyrics found"}
|
||||
@@ -57,6 +54,6 @@ def check_lyrics(body: SendLyricsBody):
|
||||
if exists:
|
||||
return {"exists": exists}, 200
|
||||
|
||||
exists = get_lyrics_from_tags(filepath, just_check=True)
|
||||
exists = get_lyrics_from_tags(trackhash, just_check=True)
|
||||
|
||||
return {"exists": exists}, 200
|
||||
|
||||
+3
-20
@@ -39,9 +39,7 @@ class TransCodeStore:
|
||||
|
||||
|
||||
class SendTrackFileQuery(BaseModel):
|
||||
filepath: str = Field(
|
||||
description="The filepath to play (if available)", default=None
|
||||
)
|
||||
filepath: str = Field(description="The filepath to play (if available)")
|
||||
quality: str = Field(
|
||||
"original",
|
||||
description="The quality of the audio file. Options: original, 1411, 1024, 512, 320, 256, 128, 96",
|
||||
@@ -85,14 +83,6 @@ def send_track_file_legacy(path: TrackHashSchema, query: SendTrackFileQuery):
|
||||
|
||||
if track is not None:
|
||||
audio_type = guess_mime_type(filepath)
|
||||
# return send_file(
|
||||
# filepath,
|
||||
# mimetype=audio_type,
|
||||
# conditional=True,
|
||||
# # environ=request.environ,
|
||||
# as_attachment=True,
|
||||
# max_age=None,
|
||||
# )
|
||||
return send_from_directory(
|
||||
Path(filepath).parent,
|
||||
Path(filepath).name,
|
||||
@@ -100,7 +90,6 @@ def send_track_file_legacy(path: TrackHashSchema, query: SendTrackFileQuery):
|
||||
conditional=True,
|
||||
as_attachment=True,
|
||||
)
|
||||
# return ""
|
||||
|
||||
return msg, 404
|
||||
|
||||
@@ -319,14 +308,8 @@ def get_start_range(range_header: str):
|
||||
|
||||
|
||||
class GetAudioSilenceBody(BaseModel):
|
||||
ending_file: str = Field(
|
||||
description="The ending file's path",
|
||||
example="/home/cwilvx/Music/Made in Kenya/Sol generation/Bensoul - Salama.mp3",
|
||||
)
|
||||
starting_file: str = Field(
|
||||
description="The beginning file's path",
|
||||
example="/home/cwilvx/Music/Tidal/Albums/Bensoul - Qwarantunes/Bensoul - Peddi.m4a",
|
||||
)
|
||||
ending_file: str = Field(description="The ending file's path")
|
||||
starting_file: str = Field(description="The beginning file's path")
|
||||
|
||||
|
||||
@api.post("/silence")
|
||||
|
||||
Reference in New Issue
Block a user