diff options
| author | Robert Honz <exislow+github@gmail.com> | 2024-03-25 14:12:28 +0100 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2024-03-25 14:12:28 +0100 |
| commit | a14f0c196562424c33fa5ef20d2a60c60d309e10 (patch) | |
| tree | f9e5e38758a263c51160f7fae70d74d75012916f /tidal_dl_ng/download.py | |
| parent | 84c8036bddf9c613e6a13095b918ba0dcc5ae3ef (diff) | |
| download | tidal-dl-ng-a14f0c196562424c33fa5ef20d2a60c60d309e10.tar.gz | |
🛠️ Fixed crash on download / search of unavailable media items.
Diffstat (limited to 'tidal_dl_ng/download.py')
| -rw-r--r-- | tidal_dl_ng/download.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py index 2afdf20..a65e5f0 100644 --- a/tidal_dl_ng/download.py +++ b/tidal_dl_ng/download.py @@ -177,20 +177,21 @@ class Download: video_download: bool = True, download_delay: bool = False, ) -> (bool, str): - # If no media instance is provided, we need to create the media instance. - if media_id and media_type: - media = instantiate_media(self.session, media_type, media_id) - elif isinstance(media, Track): - media = self.session.track(media.id, with_album=True) - elif not media: - raise MediaMissing - - # Check if media is available not deactivated / removed from TIDAL. - if not media.available: - self.fn_logger.info( - f"This track is not available for listening anymore on TIDAL. Skipping: {name_builder_item(media)}" - ) - + try: + if media_id and media_type: + # If no media instance is provided, we need to create the media instance. + media = instantiate_media(self.session, media_type, media_id) + elif isinstance(media, Track): # Check if media is available not deactivated / removed from TIDAL. + if not media.available: + self.fn_logger.info( + f"This track is not available for listening anymore on TIDAL. Skipping: {name_builder_item(media)}" + ) + else: + # Re-create media instance with full album information + media = self.session.track(media.id, with_album=True) + elif not media: + raise MediaMissing + except: return False, "" # If video download is not allowed end here |
