bugfix- not storing id for search_playlist

This commit is contained in:
codey 2025-02-11 16:53:42 -05:00
parent 46ba10a455
commit 2c368aaf1a

View File

@ -187,7 +187,7 @@ class Radio(FastAPI):
try: try:
search_artist = None search_artist = None
search_song = None search_song = None
search_query = 'SELECT id, artist, song, (artist || " - " || song) AS artistsong, file_path, duration FROM tracks\ search_query = 'SELECT id, artist, song, (artist || " - " || song) AS artistsong, genre, file_path, duration FROM tracks\
WHERE editdist3((lower(artist) || " " || lower(song)), (? || " " || ?))\ WHERE editdist3((lower(artist) || " " || lower(song)), (? || " " || ?))\
<= 410 ORDER BY editdist3((lower(artist) || " " || lower(song)), ?) ASC LIMIT 1' <= 410 ORDER BY editdist3((lower(artist) || " " || lower(song)), ?) ASC LIMIT 1'
if artistsong: if artistsong:
@ -210,10 +210,12 @@ class Radio(FastAPI):
if not result: if not result:
return False return False
pushObj = { pushObj = {
'id': result['id'],
'uuid': str(uuid().hex), 'uuid': str(uuid().hex),
'artist': result['artist'].strip(), 'artist': result['artist'].strip(),
'song': result['song'].strip(), 'song': result['song'].strip(),
'artistsong': result['artistsong'].strip(), 'artistsong': result['artistsong'].strip(),
'genre': result['genre'],
'file_path': result['file_path'], 'file_path': result['file_path'],
'duration': result['duration'], 'duration': result['duration'],
} }
@ -236,7 +238,7 @@ class Radio(FastAPI):
""" """
db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, genre, file_path, duration FROM tracks\ db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, genre, file_path, duration FROM tracks\
WHERE genre IN ("hip hop", "metalcore", "pop punk", "punk rock", "metal", "punk", "electronic", "nu metal", "EDM",\ WHERE genre IN ("metalcore", "pop punk", "punk rock", "metal", "punk", "electronic", "nu metal", "EDM",\
"post-hardcore", "pop rock", "experimental", "post-punk", "death metal", "electronicore", "hard rock", "psychedelic rock",\ "post-hardcore", "pop rock", "experimental", "post-punk", "death metal", "electronicore", "hard rock", "psychedelic rock",\
"grunge", "house", "dubstep", "hardcore", "hair metal", "horror punk", "folk punk", "breakcore",\ "grunge", "house", "dubstep", "hardcore", "hair metal", "horror punk", "folk punk", "breakcore",\
"post-rock", "deathcore", "hardcore punk", "synthwave", "trap") GROUP BY artistdashsong ORDER BY RANDOM()' "post-rock", "deathcore", "hardcore punk", "synthwave", "trap") GROUP BY artistdashsong ORDER BY RANDOM()'