This commit is contained in:
2025-01-20 05:47:09 -05:00
parent 31c8f0ac04
commit 1c7a64bc58
4 changed files with 45 additions and 10 deletions

View File

@ -112,7 +112,8 @@ class LyricSearch(FastAPI):
"IRC-KALI",
"DISC-ACES",
"DISC-HAVOC",
"IRC-SHARED"
"IRC-SHARED",
"LIMNORIA-SHARED",
]
self.lrc_regex = regex.compile(r'\[([0-9]{2}:[0-9]{2})\.[0-9]{1,3}\](\s(.*)){0,}')
@ -143,8 +144,8 @@ class LyricSearch(FastAPI):
async def song_typeahead_handler(self, data: ValidTypeAheadRequest):
"""Song Type Ahead Handler"""
if not isinstance(data.pre_query, str) or len(data.pre_query) < 2\
or not isinstance(data.query, str) or len(data.query) < 2:
if not isinstance(data.pre_query, str)\
or not isinstance(data.query, str|None):
return {
'err': True,
'errorText': 'Invalid request',
@ -183,7 +184,10 @@ class LyricSearch(FastAPI):
raise HTTPException(detail="Invalid request", status_code=500)
if data.src.upper() not in self.acceptable_request_sources:
raise HTTPException(detail="Invalid request", status_code=500)
return {
'err': True,
'errorText': f'Unknown request source: {data.src.upper()}',
}
search_artist: Optional[str] = data.a
search_song: Optional[str] = data.s