embedart: log & skip unreadable audio files

This commit is contained in:
Adrian Sampson 2012-05-21 10:47:17 -07:00
parent b3e0724676
commit 66e75c398d
2 changed files with 9 additions and 2 deletions

View file

@ -1,5 +1,5 @@
# This file is part of beets.
# Copyright 2011, Adrian Sampson.
# Copyright 2012, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@ -36,7 +36,13 @@ def _embed(path, items):
# Add art to each file.
log.debug('Embedding album art.')
for item in items:
f = mediafile.MediaFile(syspath(item.path))
try:
f = mediafile.MediaFile(syspath(item.path))
except mediafile.UnreadableFileError as exc:
log.warn('Could not embed art in {0}: {1}'.format(
repr(item.path), exc
))
continue
f.art = data
f.save()

View file

@ -35,6 +35,7 @@ Changelog
* :doc:`/plugins/chroma`: Fix occasional crash at end of fingerprint submission
and give more context to "failed fingerprint generation" errors.
* Interactive prompts are sent to stdout instead of stderr.
* :doc:`/plugins/embedart`: Fix crash when audio files are unreadable.
.. _artist credits: http://wiki.musicbrainz.org/Artist_Credit