catch ReadError when calling item.read()

This commit is contained in:
Adrian Sampson 2014-04-07 19:42:54 -07:00
parent 071a5c363d
commit 28556a0c37
3 changed files with 8 additions and 2 deletions

View file

@ -58,6 +58,10 @@ def albums_in_dir(path):
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
))
else:
items.append(i)

View file

@ -903,7 +903,7 @@ def update_items(lib, query, album, move, pretend):
# Read new data.
try:
item.read()
except Exception as exc:
except library.ReadError as exc:
log.error(u'error reading {0}: {1}'.format(
displayable_path(item.path), exc))
continue
@ -1238,7 +1238,7 @@ def write_items(lib, query, pretend):
# Get an Item object reflecting the "clean" (on-disk) state.
try:
clean_item = library.Item.from_path(item.path)
except Exception as exc:
except library.ReadError as exc:
log.error(u'error reading {0}: {1}'.format(
displayable_path(item.path), exc
))

View file

@ -17,6 +17,8 @@ Fixes:
content type. Thanks to Lee Reinhardt.
* :doc:`/plugins/convert`: The ``--keep-new`` flag now works correctly
and the library includes the converted item.
* The importer now logs a message instead of crashing when errors occur while
opening the files to be imported.
1.3.4 (April 5, 2014)