re-add support for lyric_search 't' param
This commit is contained in:
parent
c3bbd27cd5
commit
06c2d48818
@ -170,19 +170,19 @@ class LyricSearch(FastAPI):
|
|||||||
|
|
||||||
async def lyric_search_handler(self, data: ValidLyricRequest):
|
async def lyric_search_handler(self, data: ValidLyricRequest):
|
||||||
"""
|
"""
|
||||||
Search for lyrics (testing)
|
Search for lyrics
|
||||||
|
|
||||||
- **a**: artist
|
- **a**: artist
|
||||||
- **s**: song
|
- **s**: song
|
||||||
- **t**: track (artist and song combined) [used only if a & s are not used] [unused]
|
- **t**: track (artist and song combined) [used only if a & s are not used]
|
||||||
- **extra**: include extra details in response [optional, default: false] [unused]
|
- **extra**: include extra details in response [optional, default: false] [unused]
|
||||||
- **lrc**: Request LRCs?
|
- **lrc**: Request LRCs?
|
||||||
- **sub**: text to search within lyrics, if found lyrics will begin at found verse [optional, default: none]
|
- **sub**: text to search within lyrics, if found lyrics will begin at found verse [optional, default: none]
|
||||||
- **src**: the script/utility which initiated the request
|
- **src**: the script/utility which initiated the request
|
||||||
- **excluded_sources**: sources to exclude
|
- **excluded_sources**: sources to exclude [optional, default: none]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not data.a or not data.s or not data.src:
|
if (not data.a or not data.s) and not data.t or not data.src:
|
||||||
raise HTTPException(detail="Invalid request", status_code=500)
|
raise HTTPException(detail="Invalid request", status_code=500)
|
||||||
|
|
||||||
if data.src.upper() not in self.acceptable_request_sources:
|
if data.src.upper() not in self.acceptable_request_sources:
|
||||||
@ -193,9 +193,13 @@ class LyricSearch(FastAPI):
|
|||||||
'errorText': f'Unknown request source: {data.src}',
|
'errorText': f'Unknown request source: {data.src}',
|
||||||
}
|
}
|
||||||
|
|
||||||
search_artist: Optional[str] = data.a
|
if not data.t:
|
||||||
search_song: Optional[str] = data.s
|
search_artist: str = data.a
|
||||||
|
search_song: str = data.s
|
||||||
|
else:
|
||||||
|
t_split = data.t.split(" - ", maxsplit=1)
|
||||||
|
search_artist: str = t_split[0]
|
||||||
|
search_song: str = t_split[1]
|
||||||
|
|
||||||
|
|
||||||
if search_artist and search_song:
|
if search_artist and search_song:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user