diff --git a/beetsplug/embedart.py b/beetsplug/embedart.py index c6142a167..5afcebfe8 100755 --- a/beetsplug/embedart.py +++ b/beetsplug/embedart.py @@ -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() diff --git a/docs/changelog.rst b/docs/changelog.rst index 8bddf436b..08340dac6 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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