From d1b96f7e64e60946c61e340c1a4a4743ab9a9678 Mon Sep 17 00:00:00 2001 From: codey Date: Tue, 22 Apr 2025 08:04:08 -0400 Subject: [PATCH] bugfix: revise search_playlist to not rely on genre column within track_file_map (moved to separate db) --- utils/radio_util.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/utils/radio_util.py b/utils/radio_util.py index a95830e..469b9d4 100644 --- a/utils/radio_util.py +++ b/utils/radio_util.py @@ -117,7 +117,7 @@ class RadioUtil: raise RadioException("No query provided") try: search_query: str = ( - 'SELECT id, artist, song, (artist || " - " || song) AS artistsong, album, genre, file_path, duration FROM tracks\ + 'SELECT id, artist, song, (artist || " - " || song) AS artistsong, album, file_path, duration FROM tracks\ WHERE editdist3((lower(artist) || " " || lower(song)), (? || " " || ?))\ <= 410 ORDER BY editdist3((lower(artist) || " " || lower(song)), ?) ASC LIMIT 1' ) @@ -148,10 +148,12 @@ class RadioUtil: push_obj: dict = { "id": result["id"], "uuid": str(uuid().hex), - "artist": result["artist"].strip(), - "song": result["song"].strip(), + "artist": double_space.sub(" ", result["artist"].strip()), + "song": double_space.sub(" ", result["song"].strip()), "artistsong": result["artistsong"].strip(), - "genre": result["genre"], + "genre": await self.get_genre( + double_space.sub(" ", result["artist"].strip()) + ), "file_path": result["file_path"], "duration": result["duration"], }