lyric search bugfix/misc; cleanup

This commit is contained in:
codey 2025-02-17 13:02:26 -05:00
parent 405718870c
commit 36e191e27f
2 changed files with 34 additions and 8 deletions

View File

@ -150,13 +150,39 @@ class RadioUtil:
LIMITED GENRES LIMITED GENRES
""" """
db_query: str = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, genre, file_path, duration FROM tracks\ db_query: str = """SELECT distinct(LOWER(TRIM(artist)) || " - " || LOWER(TRIM(song))) AS artistdashsong, id, artist, song, genre, file_path, duration FROM tracks\
WHERE genre IN ("metalcore", "rock", "pop punk", "math rock", "punk rock",\ WHERE genre LIKE "%metalcore%"\
"metal", "punk", "electronic", "nu metal", "EDM",\ OR genre LIKE "%rock%"\
"post-hardcore", "pop rock", "experimental", "post-punk", "death metal", "electronicore", "hard rock", "psychedelic rock",\ OR genre LIKE "%pop punk%"\
"grunge", "house", "dubstep", "hardcore", "hair metal", "horror punk", "folk punk", "breakcore",\ OR genre LIKE "%math rock%"\
"post-rock", "deathcore", "hardcore punk", "synthwave",\ OR genre LIKE "%punk rock%"\
"trap", "indie pop") GROUP BY artistdashsong ORDER BY RANDOM()' OR genre LIKE "%metal%"\
OR genre LIKE "%punk%"\
OR genre LIKE "%electronic%"\
OR genre LIKE "%nu metal%"\
OR genre LIKE "%EDM%"\
OR genre LIKE "%post-hardcore%"\
OR genre LIKE "%pop rock%"\
OR genre LIKE "%experimental%"\
OR genre LIKE "%post-punk%"\
OR genre LIKE "%death metal%"\
OR genre LIKE "%electronicore%"\
OR genre LIKE "%hard rock%"\
OR genre LIKE "%psychedelic rock%"\
OR genre LIKE "%grunge%"\
OR genre LIKE "%house%"\
OR genre LIKE "%dubstep%"\
OR genre LIKE "%hardcore%"\
OR genre LIKE "%hair metal%"\
OR genre LIKE "%horror punk%"\
OR genre LIKE "%folk punk%"\
OR genre LIKE "%breakcore%"\
OR genre LIKE "%post-rock%"\
OR genre LIKE "%deathcore%"\
OR genre LIKE "%hardcore punk%"\
OR genre LIKE "%synthwave%"\
OR genre LIKE "%trap%"\
OR genre LIKE "%indie pop%" GROUP BY artistdashsong ORDER BY RANDOM()"""
""" """
LIMITED TO ONE ARTIST... LIMITED TO ONE ARTIST...

View File

@ -119,7 +119,7 @@ class DataUtils:
str: Regex scrubbed lyrics str: Regex scrubbed lyrics
""" """
lyrics = self.scrub_regex_1.sub('', lyrics) lyrics = self.scrub_regex_1.sub('', lyrics)
lyrics = self.scrub_regex_2.sub('', lyrics, flags=regex.IGNORECASE) lyrics = self.scrub_regex_2.sub('', lyrics)
lyrics = self.scrub_regex_3.sub('\n', lyrics) # Gaps between verses lyrics = self.scrub_regex_3.sub('\n', lyrics) # Gaps between verses
lyrics = self.scrub_regex_3.sub('', lyrics) lyrics = self.scrub_regex_3.sub('', lyrics)
return lyrics return lyrics