From c8a893974103c179b9557bae6d22dbb09f245d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Dudzi=C5=84ski?= <56404247+oskvr37@users.noreply.github.com> Date: Thu, 20 Nov 2025 18:13:06 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20`{album.master}`=20templ?= =?UTF-8?q?ate=20(#237)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix `predict_item_quality` logic * update `album.master` template logic * bump to 3.1a2 --- pyproject.toml | 2 +- tiddl/cli/commands/download/__init__.py | 8 ++++++-- tiddl/core/utils/format.py | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8598f04..d52eb2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "tiddl" -version = "3.1.1a1" +version = "3.1.1a2" description = "Download Tidal tracks with CLI downloader." readme = "README.md" requires-python = ">=3.13" diff --git a/tiddl/cli/commands/download/__init__.py b/tiddl/cli/commands/download/__init__.py index 1cf3cdc..04e9bbc 100644 --- a/tiddl/cli/commands/download/__init__.py +++ b/tiddl/cli/commands/download/__init__.py @@ -156,7 +156,10 @@ def download_callback( if TRACK_QUALITY in ["low", "normal"]: return TRACK_QUALITY - if TRACK_QUALITY == "max" and item.audioQuality != "HI_RES_LOSSLESS": + if ( + TRACK_QUALITY == "max" + and "HIRES_LOSSLESS" not in item.mediaMetadata.tags + ): return "high" return TRACK_QUALITY @@ -266,6 +269,7 @@ def download_callback( if album.cover and (CONFIG.metadata.cover or save_cover): cover = Cover(album.cover, size=CONFIG.cover.size) + cover._get_data() album_review = "" @@ -293,7 +297,7 @@ def download_callback( quality=get_item_quality(album_item.item), ), track_metadata=Metadata( - cover_data=cover._get_data() if cover else None, + cover_data=cover.data if cover else b"", date=str(album.releaseDate), artist=album.artist.name if album.artist else "", credits=album_item.credits, diff --git a/tiddl/core/utils/format.py b/tiddl/core/utils/format.py index 0c5d557..f23bb18 100644 --- a/tiddl/core/utils/format.py +++ b/tiddl/core/utils/format.py @@ -144,7 +144,9 @@ def generate_template_data( ), date=album.releaseDate, explicit=Explicit(getattr(album, "explicit", None)), - master=UserFormat("HIRES_LOSSLESS" in album.mediaMetadata.tags), + master=UserFormat( + "HIRES_LOSSLESS" in album.mediaMetadata.tags and quality == "MAX" + ), ) playlist_template = None