mirror of
https://github.com/beetbox/beets.git
synced 2026-01-04 15:03:22 +01:00
handle some exceptions while writing during import
A few people get freaky crashes at this point, even though it theoretically should be impossible (since reading the file succeeded earlier). This should help the import process not croak at that point.
This commit is contained in:
parent
1ad1f7634c
commit
a046551304
2 changed files with 13 additions and 3 deletions
|
|
@ -30,7 +30,7 @@ from beets import config
|
|||
from beets.util import pipeline
|
||||
from beets.util import syspath, normpath, displayable_path
|
||||
from beets.util.enumeration import enum
|
||||
from beets.mediafile import UnreadableFileError
|
||||
from beets import mediafile
|
||||
|
||||
action = enum(
|
||||
'SKIP', 'ASIS', 'TRACKS', 'MANUAL', 'APPLY', 'MANUAL_ID',
|
||||
|
|
@ -560,7 +560,7 @@ def read_tasks(session):
|
|||
not os.path.isdir(syspath(toppath)):
|
||||
try:
|
||||
item = library.Item.from_path(toppath)
|
||||
except UnreadableFileError:
|
||||
except mediafile.UnreadableFileError:
|
||||
log.warn(u'unreadable file: {0}'.format(
|
||||
util.displayable_path(toppath)
|
||||
))
|
||||
|
|
@ -867,7 +867,15 @@ def manipulate_files(session):
|
|||
item.move(True)
|
||||
|
||||
if config['import']['write'] and task.should_write_tags():
|
||||
item.write()
|
||||
try:
|
||||
item.write()
|
||||
except mediafile.UnreadableFileError as exc:
|
||||
log.error(u'error while writing ({0}): {0}'.format(
|
||||
exc,
|
||||
util.displayable_path(item.path)
|
||||
))
|
||||
except util.FilesystemError as exc:
|
||||
exc.log(log)
|
||||
|
||||
# Save new paths.
|
||||
with session.lib.transaction():
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ Other little fixes:
|
|||
Thanks to Heinz Wiesinger.
|
||||
* Fix Python 2.6 compatibility in some logging statements in
|
||||
:doc:`/plugins/chroma` and :doc:`/plugins/lastgenre`.
|
||||
* Prevent some crashes when things go really wrong when writing file metadata
|
||||
at the end of the import process.
|
||||
|
||||
|
||||
1.3.2 (December 22, 2013)
|
||||
|
|
|
|||
Loading…
Reference in a new issue