Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion beets/library/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,7 @@ def destination(
relative_to_libdir: bool = False,
basedir: bytes | None = None,
path_formats: list[PathFormat] | None = None,
extension: str | None = None,
) -> bytes:
"""Return the path in the library directory designated for the item
(i.e., where the file ought to be).
Expand Down Expand Up @@ -1262,7 +1263,9 @@ def destination(
subpath = util.asciify_path(subpath)

lib_path_str, fallback = util.legalize_path(
subpath, self.db.replacements, self.filepath.suffix
subpath,
self.db.replacements,
f".{extension}" if extension else self.filepath.suffix,
)
if fallback:
# Print an error message if legalization fell back to
Expand Down
12 changes: 11 additions & 1 deletion beetsplug/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,18 @@ def should_transcode(self, item: Item) -> bool:
return self.fmt != item.format.lower()

def get_item_destination(self, item: Item) -> bytes:
extension = (
os.fsdecode(self.command.ext)
if (
self.should_transcode(item)
and not self.config["keep_new"].get(bool)
)
else None
)
return item.destination(
basedir=self.dest, path_formats=self.path_formats
basedir=self.dest,
path_formats=self.path_formats,
extension=extension,
)

@pipeline.mutator_stage
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Bug fixes
- :doc:`plugins/lyrics`: ``beet lyrics`` no longer crashes with an
``AttributeError`` on tracks that have no stored lyrics when ``force`` is
enabled; a missing lyrics body is now treated as empty text. :bug:`6860`
- Fixed convert plugin not taking into account the new format when determining
the target path. :bug:`1360`

..
For plugin developers
Expand Down
Loading