break lines/cleanup

This commit is contained in:
codey 2025-01-15 20:21:19 -05:00
parent fdab9b2878
commit 915b77fe19

View File

@ -85,7 +85,8 @@ class Cache:
lyrics = regex.sub(r'(<br>|\n|\r\n)', ' / ', lyr_result.lyrics.strip())
lyrics = regex.sub(r'\s{2,}', ' ', lyrics)
insert_query = "INSERT INTO lyrics (src, date_retrieved, artist, song, artistsong, confidence, lyrics) VALUES(?, ?, ?, ?, ?, ?, ?)"
insert_query = "INSERT INTO lyrics (src, date_retrieved, artist, song, artistsong, confidence, lyrics)\
VALUES(?, ?, ?, ?, ?, ?, ?)"
params = (lyr_result.src, time.time(), lyr_result.artist,
lyr_result.song, artistsong, lyr_result.confidence, lyrics)
@ -128,7 +129,8 @@ class Cache:
f"{artist.strip()} {song.strip()}")
if artist == "!" and song == "!":
random_search: bool = True
search_query: str = 'SELECT id, artist, song, lyrics, src, confidence FROM lyrics ORDER BY RANDOM() LIMIT 1'
search_query: str = 'SELECT id, artist, song, lyrics, src, confidence\
FROM lyrics ORDER BY RANDOM() LIMIT 1'
search_params = None
async with await _db_cursor.execute(search_query, search_params) as db_cursor:
results: list = await db_cursor.fetchall()