misc / RQ bulk downloads for TRip
This commit is contained in:
@@ -51,7 +51,7 @@ class RadioUtil:
|
||||
'main': self.constants.RADIO_DB_QUERY,
|
||||
'rap': self.constants.RADIO_DB_QUERY_RAP,
|
||||
'pop': self.constants.RADIO_DB_QUERY_POP,
|
||||
'classical': self.constants.RADIO_DB_QUERY_CLASSICAL,
|
||||
# 'classical': self.constants.RADIO_DB_QUERY_CLASSICAL,
|
||||
'rock': self.constants.RADIO_DB_QUERY_ROCK,
|
||||
'electronic': self.constants.RADIO_DB_QUERY_ELECTRONIC,
|
||||
}
|
||||
@@ -77,7 +77,6 @@ class RadioUtil:
|
||||
"rock",
|
||||
"rap",
|
||||
"electronic",
|
||||
"classical",
|
||||
"pop",
|
||||
]
|
||||
self.active_playlist: dict[str, list[dict]] = {}
|
||||
@@ -152,10 +151,10 @@ class RadioUtil:
|
||||
filter = filter.strip().lower()
|
||||
matched: list[dict] = []
|
||||
for item in self.active_playlist[station]:
|
||||
artist: str = item.get("artist", None)
|
||||
song: str = item.get("song", None)
|
||||
artistsong: str = item.get("artistsong", None)
|
||||
album: str = item.get("album", None)
|
||||
artist: str = item.get("artist", "")
|
||||
song: str = item.get("song", "")
|
||||
artistsong: str = item.get("artistsong", "")
|
||||
album: str = item.get("album", "")
|
||||
if not artist or not song or not artistsong:
|
||||
continue
|
||||
if non_alnum.sub("", filter) in non_alnum.sub("", artistsong).lower():
|
||||
@@ -201,6 +200,8 @@ class RadioUtil:
|
||||
search_song = song
|
||||
if not artistsong:
|
||||
artistsong = f"{search_artist} - {search_song}"
|
||||
if not search_artist or not search_song or not artistsong:
|
||||
raise RadioException("No query provided")
|
||||
search_params = (
|
||||
search_artist.lower(),
|
||||
search_song.lower(),
|
||||
@@ -280,6 +281,8 @@ class RadioUtil:
|
||||
"""
|
||||
try:
|
||||
added_rows: int = 0
|
||||
artist = None
|
||||
genre = None
|
||||
with sqlite3.connect(self.artist_genre_db_path, timeout=2) as _db:
|
||||
for pair in pairs:
|
||||
try:
|
||||
@@ -388,7 +391,7 @@ class RadioUtil:
|
||||
|
||||
for playlist in self.playlists:
|
||||
playlist_redis_key: str = f"playlist:{playlist}"
|
||||
_playlist = await self.redis_client.json().get(playlist_redis_key)
|
||||
_playlist = await self.redis_client.json().get(playlist_redis_key) # type: ignore
|
||||
if playlist not in self.active_playlist.keys():
|
||||
self.active_playlist[playlist] = []
|
||||
if not playlist == "rock":
|
||||
@@ -418,7 +421,7 @@ class RadioUtil:
|
||||
logging.info("Removing duplicate tracks...")
|
||||
dedupe_processed = []
|
||||
for item in self.active_playlist[playlist]:
|
||||
artistsongabc: str = non_alnum.sub("", item.get("artistsong", None))
|
||||
artistsongabc: str = non_alnum.sub("", item.get("artistsong", ""))
|
||||
if not artistsongabc:
|
||||
logging.info("Missing artistsong: %s", item)
|
||||
continue
|
||||
|
Reference in New Issue
Block a user