From aa9574b1e5ab9502c6cf501682ffef636e51e7db Mon Sep 17 00:00:00 2001 From: Ognyan Moore Date: Fri, 17 Oct 2025 22:19:44 +0300 Subject: [PATCH] Use new format in determining destination. When figuring out what the filepath should be for the converted file, we temporarily change the item format to represent the format of the converted file. After determining what the path is, we restore the format attribute so the rest of the codepath logic checks out. --- beetsplug/convert.py | 6 +++++- docs/changelog.rst | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/beetsplug/convert.py b/beetsplug/convert.py index e72f8c75a..a005e7831 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -355,8 +355,12 @@ class ConvertPlugin(BeetsPlugin): item, original, converted = None, None, None while True: item = yield (item, original, converted) + # item format should represent the converted format, not the original + original_format, new_format = item.format, fmt.upper() + item.format = new_format dest = item.destination(basedir=dest_dir, path_formats=path_formats) - + # need to restore this attribute for checks further along + item.format = original_format # Ensure that desired item is readable before processing it. Needed # to avoid any side-effect of the conversion (linking, keep_new, # refresh) if we already know that it will fail. diff --git a/docs/changelog.rst b/docs/changelog.rst index c5a0dab53..7882a74a7 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -80,6 +80,8 @@ Bug fixes: - |BeetsPlugin|: load the last plugin class defined in the plugin namespace. :bug:`6093` +- Fixed convert plugin not taking into account the new format when determining + the target path. :bug:`1360` For packagers: