Except for the `keep_new` mechanism, it is not useful to use the `original`
variable which is equal to the `item.path` variable. Since refresh only
makes sense when `keep_new` is false, only use for the pair of `item.path`
and `dest` variables for clarity (and not `original` and `converted`
variables).
- Implement @snejus comment from the 2026-04-19
- This change the silent no-op when both refresh and keep_new are used
to proper logging messages depending on what combination of option is
used
- Also harmonize the usage of terms "target" and "destination" between
logging messages
Nest and combine some logic tests by:
1. Only check for destination file existence once.
2. Use `original` instead of `item.path` in the `refresh` conditional
such that this option will be compatible with `keep_new`.
- `util.syspath` is redundant because already called in `util.normpath`
itself called in Item class
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
- Use an explicit pipeline import for convert pipeline setup and decorators.
- This fixes AttributeError when beets.util does not automatically expose
pipeline.
Update all references in core, plugins, and tests to import UserError
from the new location. This centralizes exception handling and improves
code organization.
Build playlist paths using the selected format (`--format`/config), and only
replace extensions when the destination file is actually transcoded.
Precompute playlist entries before conversion runs so `--keep-new` does not
pick up mutated item paths and produce mismatched extensions.
Add/expand convert CLI tests to cover:
- config format playlist extension
- `--format` override playlist extension
- no-transcode (`no_convert`) playlist extension
- `--keep-new` destination playlist path behavior
## Description
Fixes#5625
When `convert.never_convert_lossy_files` is enabled, `beet convert` was
ignoring the explicit `--format` option and just copying the lossy files
without
transcoding them. For example:
- `beet convert format:mp3 --format opus`
would still produce MP3 files instead of OPUS.
Change:
- Allows to override options `never_convert_lossy_files`, `max_bitrate`
or `no_convert` for `beet convert` as well as trying to convert to the
same format as existing already with a new option `--force`. That way,
for example lossy files selected by the query are transcoded to the
requested format anyway.
- Keeps existing behavior for automatic conversion on import (no CLI
override there).
- Adds tests to cover checking whether `--force` correctly overrides
settings or CLI options.
- Documents the behavior in the convert plugin docs
Co-authored-by: J0J0 Todos <jojo@peek-a-boo.at>