From 3197795faaaed07dbd59dc8df41bec791622d759 Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Sun, 14 Sep 2014 11:27:59 +0200 Subject: [PATCH] convert: Change file extension only if actually transcoded This makes the tests from a37cabb969edfcc34a6ec628b1bd97eda15eeedd pass. --- beetsplug/convert.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/beetsplug/convert.py b/beetsplug/convert.py index a72965b43..6e7440cbc 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -150,10 +150,9 @@ def convert_item(dest_dir, keep_new, path_formats, format, pretend=False): # back to its old path or transcode it to a new path. if keep_new: original = dest - converted = replace_ext(item.path, ext) + converted = item.path else: original = item.path - dest = replace_ext(dest, ext) converted = dest # Ensure that only one thread tries to create directories at a @@ -194,6 +193,7 @@ def convert_item(dest_dir, keep_new, path_formats, format, pretend=False): ) util.copy(original, converted) else: + converted = replace_ext(converted, ext) try: encode(command, original, converted, pretend) except subprocess.CalledProcessError: @@ -217,7 +217,12 @@ def convert_item(dest_dir, keep_new, path_formats, format, pretend=False): if album and album.artpath: embed_item(item, album.artpath, itempath=converted) - plugins.send('after_convert', item=item, dest=dest, keepnew=keep_new) + if keep_new: + plugins.send('after_convert', item=item, + dest=dest, keepnew=True) + else: + plugins.send('after_convert', item=item, + dest=converted, keepnew=False) def convert_on_import(lib, item):