From cb8a07bf540152d988cebb00ec840e8c71046e0f Mon Sep 17 00:00:00 2001 From: Salt Date: Fri, 6 Mar 2020 04:59:11 -0600 Subject: [PATCH] Fix checking for ALBUMS named meta, not SONGS WHUPS That's pretty big --- badwitch.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/badwitch.py b/badwitch.py index 8fb2adf..4a78e42 100755 --- a/badwitch.py +++ b/badwitch.py @@ -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'])