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