From 87ba06ce11b8b397265c258666546dec65ecdb4b Mon Sep 17 00:00:00 2001 From: nralego8 Date: Sun, 17 Sep 2023 08:04:14 -0700 Subject: [PATCH] Added fixed zfill option --- orpheus/core.py | 2 ++ orpheus/music_downloader.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/orpheus/core.py b/orpheus/core.py index bed2ee8..bc6a902 100644 --- a/orpheus/core.py +++ b/orpheus/core.py @@ -48,6 +48,8 @@ def __init__(self, private_mode=False): "track_filename_format": "{track_number}. {name}", "single_full_path_format": "{name}", "enable_zfill": True, + "enable_fixed_zfill": True, + "fixed_zfill": 2, "force_album_format": False }, "codecs": { diff --git a/orpheus/music_downloader.py b/orpheus/music_downloader.py index 597eb45..440ea61 100644 --- a/orpheus/music_downloader.py +++ b/orpheus/music_downloader.py @@ -302,7 +302,12 @@ def download_track(self, track_id, album_location='', main_artist='', track_inde track_info.tags.track_number = track_index if number_of_tracks: track_info.tags.total_tracks = number_of_tracks - zfill_number = len(str(track_info.tags.total_tracks)) if self.download_mode is not DownloadTypeEnum.track else 1 + + if (self.global_settings['formatting']['enable_fixed_zfill']): + zfill_number = self.global_settings['formatting']['fixed_zfill'] + else: + zfill_number = len(str(track_info.tags.total_tracks)) if self.download_mode is not DownloadTypeEnum.track else 1 + zfill_lambda = lambda input : sanitise_name(str(input)).zfill(zfill_number) if input is not None else None # Separate copy of tags for formatting purposes