From 945e30d1555c090e449c2919826ecba6b4feb5a2 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 10 Aug 2014 17:18:10 -0700 Subject: [PATCH] Fix music-crawl error messages (thanks, derwin) Due to the new exception nesting stuff, we were catching and emitting exceptions where none was necessary: specifically, when the file was non-music (which is expected, especially when there are images). --- beets/autotag/__init__.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index b6e2c8f23..86c104b84 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -52,16 +52,19 @@ def albums_in_dir(path): for filename in files: try: i = library.Item.from_path(os.path.join(root, filename)) - except mediafile.FileTypeError: - pass - except mediafile.UnreadableFileError: - log.warn(u'unreadable file: {0}'.format( - displayable_path(filename)) - ) except library.ReadError as exc: - log.error(u'error reading {0}: {1}'.format( - displayable_path(filename), exc - )) + if isinstance(exc.reason, mediafile.FileTypeError): + # Silently ignore non-music files. + pass + elif isinstance(exc.reason, mediafile.UnreadableFileError): + log.warn(u'unreadable file: {0}'.format( + displayable_path(filename)) + ) + else: + log.error(u'error reading {0}: {1}'.format( + displayable_path(filename), + exc, + )) else: items.append(i)