Added a try/except block so the post-processor continues when it finds a

file that beets/mutagen can't parse. It should probably fail
post-processing here but I'm not sure about the best way to do that.
Without the try block the post-processor (automatic) just dies without
comment after "Writing Metadata" - the force would show an error but the
auto would just silently die.
This commit is contained in:
sbuser
2011-08-12 20:27:05 -05:00
parent bb4dfe375e
commit a584014bcd

View File

@@ -356,7 +356,10 @@ def correctMetadata(albumid, release, downloaded_track_list):
logger.info('Writing metadata')
items = []
for downloaded_track in downloaded_track_list:
items.append(beets.library.Item.from_path(downloaded_track))
try:
items.append(beets.library.Item.from_path(downloaded_track))
except Exception, e:
logger.error("Beets couldn't create an Item from: " + downloaded_track + " - not a media file?" + str(e))
cur_artist, cur_album, out_tuples, rec = autotag.tag_album(items, search_artist=release['ArtistName'], search_album=release['AlbumTitle'])
@@ -383,6 +386,7 @@ def renameFiles(albumpath, downloaded_track_list, release):
try:
f = MediaFile(downloaded_track)
except:
logger.info("MediaFile couldn't parse: " + downloaded_track)
continue
if not f.track: