mirror of
https://github.com/beetbox/beets.git
synced 2025-12-28 19:42:42 +01:00
convert: Change file extension only if actually transcoded
This makes the tests from a37cabb969
pass.
This commit is contained in:
parent
a37cabb969
commit
3197795faa
1 changed files with 8 additions and 3 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue