diff --git a/streamrip/media/album.py b/streamrip/media/album.py index 446097c..7d97346 100644 --- a/streamrip/media/album.py +++ b/streamrip/media/album.py @@ -7,6 +7,7 @@ from ..client import Client from ..config import Config from ..db import Database +from ..exceptions import NonStreamableError from ..filepath_utils import clean_filepath from ..metadata import AlbumMetadata from ..metadata.util import get_album_track_ids @@ -50,7 +51,14 @@ class PendingAlbum(Pending): db: Database async def resolve(self) -> Album | None: - resp = await self.client.get_metadata(self.id, "album") + try: + resp = await self.client.get_metadata(self.id, "album") + except NonStreamableError as e: + logger.error( + f"Album {self.id} not available to stream on {self.client.source} ({e})", + ) + return None + meta = AlbumMetadata.from_album_resp(resp, self.client.source) if meta is None: logger.error( diff --git a/streamrip/media/artist.py b/streamrip/media/artist.py index 319bcb4..0093e06 100644 --- a/streamrip/media/artist.py +++ b/streamrip/media/artist.py @@ -7,6 +7,7 @@ from ..config import Config, QobuzDiscographyFilterConfig from ..console import console from ..db import Database +from ..exceptions import NonStreamableError from ..metadata import ArtistMetadata from .album import Album, PendingAlbum from .media import Media, Pending @@ -180,8 +181,15 @@ class PendingArtist(Pending): config: Config db: Database - async def resolve(self) -> Artist: - resp = await self.client.get_metadata(self.id, "artist") + async def resolve(self) -> Artist | None: + try: + resp = await self.client.get_metadata(self.id, "artist") + except NonStreamableError as e: + logger.error( + f"Artist {self.id} not available to stream on {self.client.source} ({e})", + ) + return None + meta = ArtistMetadata.from_resp(resp, self.client.source) albums = [ PendingAlbum(album_id, self.client, self.config, self.db) diff --git a/streamrip/media/playlist.py b/streamrip/media/playlist.py index 8227899..2e84a85 100644 --- a/streamrip/media/playlist.py +++ b/streamrip/media/playlist.py @@ -147,7 +147,14 @@ class PendingPlaylist(Pending): db: Database async def resolve(self) -> Playlist | None: - resp = await self.client.get_metadata(self.id, "playlist") + try: + resp = await self.client.get_metadata(self.id, "playlist") + except NonStreamableError as e: + logger.error( + f"Playlist {self.id} not available to stream on {self.client.source} ({e})", + ) + return None + meta = PlaylistMetadata.from_resp(resp, self.client.source) name = meta.name parent = self.config.session.downloads.folder @@ -261,6 +268,7 @@ async def _make_query( if that fails. Args: + ---- query (str): Query to search s (Status): callback: function to call after each query completes