diff --git a/streamrip/client/downloadable.py b/streamrip/client/downloadable.py index 241aaf7..d778a8f 100644 --- a/streamrip/client/downloadable.py +++ b/streamrip/client/downloadable.py @@ -124,14 +124,14 @@ def __init__(self, session: aiohttp.ClientSession, info: dict): self.session = session self.url = info["url"] self.source: str = "deezer" - try: - max_quality_available = max( - i for i, size in enumerate(info["quality_to_size"]) if size > 0 - ) - except: + qualities_available = [ + i for i, size in enumerate(info["quality_to_size"]) if size > 0 + ] + if len(qualities_available) == 0: raise NonStreamableError( "Missing download info. Skipping.", ) + max_quality_available = max(qualities_available) self.quality = min(info["quality"], max_quality_available) self._size = info["quality_to_size"][self.quality] if self.quality <= 1: diff --git a/streamrip/media/playlist.py b/streamrip/media/playlist.py index 4109d43..bf3bbbe 100644 --- a/streamrip/media/playlist.py +++ b/streamrip/media/playlist.py @@ -79,7 +79,7 @@ async def resolve(self) -> Track | None: self.client.get_downloadable(self.id, quality), ) except NonStreamableError as e: - logger.error(f"Error fetching download info for track {self.id}: %s", e) + logger.error(f"Error fetching download info for track {self.id}: {e}") self.db.set_failed(self.client.source, "track", self.id) return None