Add genre
This commit is contained in:
parent
d4809e1b30
commit
3015586431
@ -43,6 +43,7 @@ class Radio(FastAPI):
|
||||
self.now_playing = {
|
||||
'artist': 'N/A',
|
||||
'song': 'N/A',
|
||||
'genre': 'N/A',
|
||||
'artistsong': 'N/A - N/A',
|
||||
'duration': 0,
|
||||
'start': 0,
|
||||
@ -227,8 +228,18 @@ class Radio(FastAPI):
|
||||
try:
|
||||
logging.critical(f"Loading playlist...")
|
||||
self.active_playlist.clear()
|
||||
db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, file_path, duration FROM tracks\
|
||||
GROUP BY artistdashsong ORDER BY RANDOM()'
|
||||
# db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, genre, file_path, duration FROM tracks\
|
||||
# GROUP BY artistdashsong ORDER BY RANDOM()'
|
||||
|
||||
"""
|
||||
LIMITED GENRES
|
||||
"""
|
||||
|
||||
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",\
|
||||
"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",\
|
||||
"post-rock", "deathcore", "hardcore punk", "synthwave", "trap") GROUP BY artistdashsong ORDER BY RANDOM()'
|
||||
|
||||
async with sqlite3.connect(self.active_playlist_path,
|
||||
timeout=2) as db_conn:
|
||||
@ -240,6 +251,7 @@ class Radio(FastAPI):
|
||||
'id': r['id'],
|
||||
'artist': double_space.sub(' ', r['artist']).strip(),
|
||||
'song': double_space.sub(' ', r['song']).strip(),
|
||||
'genre': r['genre'] if r['genre'] else 'Unknown',
|
||||
'artistsong': double_space.sub(' ', r['artistdashsong']).strip(),
|
||||
'file_path': r['file_path'],
|
||||
'duration': r['duration'],
|
||||
|
@ -76,6 +76,11 @@ class RadioUtil:
|
||||
"value": self.duration_conv(track['duration']),
|
||||
"inline": True,
|
||||
},
|
||||
{
|
||||
"name": "Genre",
|
||||
"value": track['genre'] if track['genre'] else 'Unknown',
|
||||
"inline": True,
|
||||
},
|
||||
{
|
||||
"name": "Filetype",
|
||||
"value": track['file_path'].rsplit(".", maxsplit=1)[1],
|
||||
|
Loading…
x
Reference in New Issue
Block a user