From 6402b664c6b8f67aaf4b8768c3e63f74ddf4850d Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Mon, 7 Apr 2014 20:17:55 +0200 Subject: [PATCH] More refactoring for convert --- beets/library.py | 5 +++-- beetsplug/convert.py | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/beets/library.py b/beets/library.py index 349f8459a..fb205b4be 100644 --- a/beets/library.py +++ b/beets/library.py @@ -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. diff --git a/beetsplug/convert.py b/beetsplug/convert.py index 6738faaac..be97aab0f 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -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)