Account for metadata when adding zeroes, break to kill entire download operation
This commit is contained in:
parent
cf9722516f
commit
42d4edabb7
@ -90,11 +90,14 @@ class Library:
|
||||
destpath = (Path.home() / 'Music' / albumartist / album)
|
||||
Path(destpath).mkdir(parents=True, exist_ok=True)
|
||||
# Actually download and tag songs
|
||||
try:
|
||||
for song, songcontent in albumcontent.items():
|
||||
if song == 'meta':
|
||||
continue
|
||||
try:
|
||||
if metadata == {}:
|
||||
zeroes = int(math.log10(len(albumcontent)) + 1)
|
||||
else:
|
||||
zeroes = int(math.log10(len(albumcontent) - 1) + 1)
|
||||
filename = str(songcontent['track']).zfill(zeroes) + ' - ' + song
|
||||
destfile = str(destpath / filename) + '.%(ext)s'
|
||||
logging.debug('Saving to: ' + destfile)
|
||||
|
Reference in New Issue
Block a user