From bbb6051fdd34fabf7565df480df66c128ffa4ef5 Mon Sep 17 00:00:00 2001 From: Robert Honz Date: Wed, 13 Mar 2024 06:38:13 +0100 Subject: ✨ Track media items will be re-created with album information. Path format refactored. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tidal_dl_ng/helper/path.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tidal_dl_ng/helper/path.py') diff --git a/tidal_dl_ng/helper/path.py b/tidal_dl_ng/helper/path.py index 81b7b1a..65f9163 100644 --- a/tidal_dl_ng/helper/path.py +++ b/tidal_dl_ng/helper/path.py @@ -101,16 +101,16 @@ def format_str_media(name: str, media: Track | Album | Playlist | UserPlaylist | result = media.name elif isinstance(media, Track): result = media.album.name - elif name == "track_num": + elif name == "album_track_num": if isinstance(media, Track | Video): num_tracks: int = media.album.num_tracks if hasattr(media, "album") else 1 - count_digits: int = int(math.log10(len(str(num_tracks)))) + 1 + count_digits: int = int(math.log10(num_tracks)) + 1 result = str(media.track_num).zfill(count_digits) - elif name == "track_id": + elif name == "album_num_tracks": if isinstance(media, Track | Video): - result = media.id + result = str(media.album.num_tracks if hasattr(media, "album") else 1) elif name == "track_id": - if isinstance(media, Track): + if isinstance(media, Track | Video): result = media.id elif name == "playlist_id": if isinstance(media, Playlist): @@ -148,6 +148,7 @@ def format_str_media(name: str, media: Track | Album | Playlist | UserPlaylist | except Exception as e: # TODO: Implement better exception logging. print(e) + pass return result -- cgit v1.3.1