Переименование заполнителя, форматирование кода

This commit is contained in:
Lev Plyusnin 2024-04-23 22:22:05 +07:00
parent 2c510f37ed
commit 184d1d1aeb
No known key found for this signature in database
GPG key ID: 21C6C2C9C0A4460D
2 changed files with 10 additions and 6 deletions

View file

@ -238,13 +238,14 @@ def main():
covers_cache: dict[str, bytes] = {}
track_number = 0
# track number should be padded to an appropriate string width with zeroes, e.g:
# up to 99 tracks in total - 01, 02, ...; up to 999 tracks - 001, 002, ...; etc.
track_number_pad = len(str(len(result_tracks))) # get max track number width
track_number_pad = len(str(len(result_tracks)))
for track in result_tracks:
track_number += 1
save_path = args.dir / core.prepare_track_path(
args.path_pattern, track, args.unsafe_path, str(track_number).zfill(track_number_pad)
args.path_pattern,
track,
args.unsafe_path,
str(track_number).zfill(track_number_pad),
)
if args.skip_existing and save_path.is_file():
continue

View file

@ -19,7 +19,10 @@ DEFAULT_COVER_RESOLUTION = 400
def prepare_track_path(
path_pattern: Path, track: BasicTrackInfo, unsafe_path: bool = False, track_number_str: str = ""
path_pattern: Path,
track: BasicTrackInfo,
unsafe_path: bool = False,
track_number_str: str = "",
) -> Path:
path_str = str(path_pattern)
album = track.album
@ -29,7 +32,7 @@ def prepare_track_path(
"#artist-id": artist.name,
"#album-id": album.id,
"#track-id": track.id,
"#track-number": track_number_str,
"#number-padded": track_number_str,
"#number": track.number,
"#artist": artist.name,
"#title": track.title,