More refactoring for convert

This commit is contained in:
Thomas Scholtes 2014-04-07 20:17:55 +02:00
parent 6eb497b21b
commit 6402b664c6
2 changed files with 5 additions and 5 deletions

View file

@ -441,8 +441,9 @@ class Item(LibModel):
raise WriteError(self.path, exc)
# The file has a new mtime.
self.mtime = self.current_mtime()
plugins.send('after_write', item=self)
if path == self.path:
self.mtime = self.current_mtime()
plugins.send('after_write', item=self, path=path)
# Files themselves.

View file

@ -176,15 +176,13 @@ def convert_item(dest_dir, keep_new, path_formats):
except subprocess.CalledProcessError:
continue
if keep_new:
item.path = converted
# Write tags from the database to the converted file.
item.write(path=converted)
if keep_new:
# If we're keeping the transcoded file, read it again (after
# writing) to get new bitrate, duration, etc.
item.path = converted
item.read()
item.store() # Store new path and audio data.
@ -194,6 +192,7 @@ def convert_item(dest_dir, keep_new, path_formats):
artpath = album.artpath
if artpath:
_embed(artpath, [item])
plugins.send('after_convert', item=item, dest=dest, keepnew=keep_new)