Skip to content

Commit

Permalink
Skipping tracks on any NonStreamableError when getting downloadable i…
Browse files Browse the repository at this point in the history
…nfo (#645)

Based on the linked issue, also added check for fallback_id as it was empty and didn't result in a correct final error
  • Loading branch information
mortalis13 committed Jun 23, 2024
1 parent 5c6e452 commit 22f7d87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion streamrip/client/deezer.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async def get_downloadable(
"quality allowed is 1.",
)
except deezer.WrongGeolocation:
if not is_retry:
if not is_retry and fallback_id:
return await self.get_downloadable(fallback_id, quality, is_retry=True)
raise NonStreamableError(
"The requested track is not available. This may be due to your country/location.",
Expand Down
8 changes: 6 additions & 2 deletions streamrip/media/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def resolve(self) -> Track | None:
try:
meta = TrackMetadata.from_resp(self.album, source, resp)
except Exception as e:
logger.error(f"Error building track metadata for {id=}: {e}")
logger.error(f"Error building track metadata for {self.id}: {e}")
return None

if meta is None:
Expand All @@ -147,7 +147,11 @@ async def resolve(self) -> Track | None:
return None

quality = self.config.session.get_source(source).quality
downloadable = await self.client.get_downloadable(self.id, quality)
try:
downloadable = await self.client.get_downloadable(self.id, quality)
except NonStreamableError as e:
logger.error(f'Error getting downloadable data for track {meta.tracknumber} [{self.id}]: {e}')
return None

downloads_config = self.config.session.downloads
if downloads_config.disc_subdirectories and self.album.disctotal > 1:
Expand Down

0 comments on commit 22f7d87

Please sign in to comment.