re-add support for lyric_search 't' param

This commit is contained in:
codey 2025-01-24 10:26:27 -05:00
parent c3bbd27cd5
commit 06c2d48818

View File

@ -170,19 +170,19 @@ class LyricSearch(FastAPI):
async def lyric_search_handler(self, data: ValidLyricRequest):
"""
Search for lyrics (testing)
Search for lyrics
- **a**: artist
- **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]
- **lrc**: Request LRCs?
- **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
- **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)
if data.src.upper() not in self.acceptable_request_sources:
@ -193,9 +193,13 @@ class LyricSearch(FastAPI):
'errorText': f'Unknown request source: {data.src}',
}
search_artist: Optional[str] = data.a
search_song: Optional[str] = data.s
if not data.t:
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: