Fix checking for ALBUMS named meta, not SONGS

WHUPS
That's pretty big
This commit is contained in:
Salt 2020-03-06 04:59:11 -06:00
parent 61d6e880cb
commit cb8a07bf54

View File

@ -46,9 +46,9 @@ class Library:
def validate(self):
self.load()
for album, albumcontent in self.albums.items():
if album == 'meta':
continue
for song, songcontent in albumcontent.items():
if song == 'meta':
continue
for field in ['track', 'artist', 'source']:
if field not in songcontent:
raise Exception('Song is missing required field', song, field)
@ -69,14 +69,12 @@ class Library:
if targetalbum is not None and not album == targetalbum:
logging.debug('Skipping album ' + album)
continue
# Just skip metadata (for now)
if album == 'meta':
logging.debug('Skipping metadata entry for album ' + album)
continue
# Get albumartist
# Sets to Various Artists if multiple
albumartist=''
for song, songcontent in albumcontent.items():
if song == 'meta':
continue
if albumartist == '':
albumartist = songcontent['artist']
elif albumartist != songcontent['artist']:
@ -86,6 +84,8 @@ class Library:
Path(destpath).mkdir(parents=True, exist_ok=True)
# Actually download and tag songs
for song, songcontent in albumcontent.items():
if song == 'meta':
continue
try:
zeroes = int(math.log10(len(albumcontent)) + 1)
filename = str(songcontent['track']).zfill(zeroes) + ' - ' + song
@ -239,10 +239,10 @@ class BadWitch:
print('Closing library')
elif self.args.action == 'list':
for album, albumcontent in lib.albums.items():
if album == 'meta':
continue
print(album)
for song, songcontent in albumcontent.items():
if song == 'meta':
continue
print(str(songcontent['track'])
+ ' - ' + song
+ ' by ' + songcontent['artist'])