Skip to content

Commit

Permalink
Merge pull request #1 from nathom/dev
Browse files Browse the repository at this point in the history
Fix for [BUG] max() iterable argument is empty nathom#677 (nathom#683)
  • Loading branch information
EllipPro authored Jun 12, 2024
2 parents ee62122 + 5c6e452 commit bbb8baf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions streamrip/client/downloadable.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,14 @@ def __init__(self, session: aiohttp.ClientSession, info: dict):
self.session = session
self.url = info["url"]
self.source: str = "deezer"
max_quality_available = max(
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:
Expand Down
2 changes: 1 addition & 1 deletion streamrip/media/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def resolve(self) -> Track | None:
self.client.get_downloadable(self.id, quality),
)
except NonStreamableError as e:
logger.error("Error fetching download info for track: %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

Expand Down

0 comments on commit bbb8baf

Please sign in to comment.