progress -- change get to search for lrclib

This commit is contained in:
2025-01-14 10:04:05 -05:00
parent 9d8d38081a
commit f86d5a4fec
6 changed files with 113 additions and 8 deletions

View File

@ -123,8 +123,14 @@ class LyricSearch(FastAPI):
aggregate_search = aggregate.Aggregate()
result = await aggregate_search.search(data.a, data.s)
if not result:
return {
'err': True,
'errorText': 'Sources exhausted, lyrics not located.',
}
result = result.dict()
result['lyrics'] = regex.sub(r'(\s/\s|\n)', '<br>', result['lyrics']).strip()
result['confidence'] = f'{float(result.get('confidence', 0)):.2f}'
return result