diff --git a/badwitch.py b/badwitch.py index 2d8987d..8fb2adf 100755 --- a/badwitch.py +++ b/badwitch.py @@ -122,6 +122,16 @@ class Library: resultfile.tag.album = album resultfile.tag.title = song resultfile.tag.track_num = songcontent['track'] + # Add optional album metadata tags + if 'genre' in metadata: + resultfile.tag.genre = metadata['genre'] + if 'publisher' in metadata: + resultfile.tag.publisher = metadata['publisher'] + if 'release_date' in metadata: + resultfile.tag.original_release_date = metadata['release_date'] + if 'composer' in metadata: + resultfile.tag.composer = metadata['composer'] + # Save resultfile.tag.save() except (KeyboardInterrupt, EOFError): logging.debug('Interrupt received, exiting') @@ -167,7 +177,7 @@ class BadWitch: print('Loaded library ' + lib.file) try: while True: - in_album = input('\tAlbum: ') + in_album = input('\t*Album: ') auto_artist = input('\tArtist (leave blank to assign per song): ') auto_track = int(input('\tStarting track number (leave blank to assign per song): ') or -1) if in_album not in lib.albums: @@ -180,8 +190,10 @@ class BadWitch: if 'meta' not in album: album['meta'] = {} metadata = album['meta'] - meta_releaseyear = input('\tRelease year: ') - if meta_releaseyear is not '': metadata['releaseyear'] = meta_releaseyear + # Metadata fields sorted in order of popularity... ish + for field in ['genre', 'publisher', 'release_date', 'composer']: + in_value = input('\t' + field + ': ') + if in_value is not '': metadata[field] = in_value # Input songs while True: in_song = input('\t\t*Song title: ') @@ -227,6 +239,8 @@ 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(): print(str(songcontent['track'])