From a676e1636718d0df824c026bbe29512724758f40 Mon Sep 17 00:00:00 2001 From: Robert Honz Date: Sun, 29 Jun 2025 21:23:27 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20=20App=20does=20not?= =?UTF-8?q?=20crash=20anymore=20on=20not=20available=20content.=20Fixes=20?= =?UTF-8?q?#422?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tidal_dl_ng/cli.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tidal_dl_ng/cli.py b/tidal_dl_ng/cli.py index 3074306..75deba4 100644 --- a/tidal_dl_ng/cli.py +++ b/tidal_dl_ng/cli.py @@ -22,6 +22,12 @@ from tidal_dl_ng.constants import CTX_TIDAL, MediaType from tidal_dl_ng.download import Download from tidal_dl_ng.helper.path import get_format_template, path_file_settings from tidal_dl_ng.helper.tidal import ( + Album, + Artist, + Mix, + Playlist, + Track, + Video, all_artist_album_ids, get_tidal_media_id, get_tidal_media_type, @@ -128,13 +134,20 @@ def _download(ctx: typer.Context, urls: list[str], try_login: bool = True) -> bo continue + try: + media: Track | Video | Album | Playlist | Mix | Artist = instantiate_media( + ctx.obj[CTX_TIDAL].session, media_type, item_id + ) + except Exception: + print(f"Media not found (ID: {item_id}). Maybe it is not available anymore.") + continue + # Download media. if media_type in [MediaType.TRACK, MediaType.VIDEO]: download_delay: bool = bool(settings.data.download_delay and urls.index(item) < urls_pos_last) dl.item( - media_id=item_id, - media_type=media_type, + media=media, file_template=file_template, download_delay=download_delay, quality_audio=settings.data.quality_audio, @@ -144,7 +157,6 @@ def _download(ctx: typer.Context, urls: list[str], try_login: bool = True) -> bo item_ids: [int] = [] if media_type == MediaType.ARTIST: - media = instantiate_media(ctx.obj[CTX_TIDAL].session, media_type, item_id) media_type = MediaType.ALBUM item_ids = item_ids + all_artist_album_ids(media) else: From e8ca69fefa869f5e1b518e50a91f7ea51a5838fe Mon Sep 17 00:00:00 2001 From: Robert Honz Date: Sun, 29 Jun 2025 21:29:06 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20=20GUI=20dos=20not?= =?UTF-8?q?=20hang=20if=20searched=20media=20is=20not=20available=20anymor?= =?UTF-8?q?e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tidal_dl_ng/gui.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py index 9b87958..8f165d2 100644 --- a/tidal_dl_ng/gui.py +++ b/tidal_dl_ng/gui.py @@ -618,6 +618,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): result = [] for idx, item in enumerate(items): + if not item: + continue + explicit: str = "" # Check if item is available on TIDAL. if hasattr(item, "available") and not item.available: