-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix convert --format with never_convert_lossy_files #6171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- The new override_never_lossy flag is threaded through many calls—consider encapsulating CLI override state in the plugin instance or a context object to simplify these long method signatures.
- Rename override_never_lossy to something like force_transcode or force_convert for clearer intent when reading the should_transcode code path.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new override_never_lossy flag is threaded through many calls—consider encapsulating CLI override state in the plugin instance or a context object to simplify these long method signatures.
- Rename override_never_lossy to something like force_transcode or force_convert for clearer intent when reading the should_transcode code path.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Hi! My PR is failing the "Get changed docs files" check, but it seems to be a workflow configuration issue rather than a problem with my code. |
docs/plugins/convert.rst
Outdated
| or linked as-is. If you explicitly pass a target format on the command line | ||
| with ``--format``, this override is respected: lossy files matching the query | ||
| will be transcoded to the requested format even when | ||
| ``never_convert_lossy_files`` is enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm the typical cli-way for overriding something that is configured is a --force option. Would you mind adding one and changing the logic? That way convert --help could also explain this feature most obvious without having to find out it's even existing by looking it up in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for the suggestion. I’ve added a --force option to beet convert which overrides no_convert and never_convert_lossy_files. The docs are updated and I've added a regression test for this issue
Description
Fixes #5625
When
convert.never_convert_lossy_filesis enabled,beet convertwasignoring the explicit
--formatoption and just copying the lossy files withouttranscoding them. For example:
beet convert format:mp3 --format opuswould still produce MP3 files instead of OPUS.
Change:
Threads information about whether
--formatwas provided on the CLI downinto the convert plugin.
Allows an explicit
--formatto overridenever_convert_lossy_filesforbeet convert, so lossy files selected by the query are transcoded to therequested format.
Keeps existing behavior for automatic conversion on import (no CLI
override there).
Adds a regression test in
NeverConvertLossyFilesTestto cover this case.Documents the behavior in the convert plugin docs and adds a changelog entry.
Documentation. (Clarified the --format override interaction in docs/plugins/convert.rst)
Changelog. (Added entry to docs/changelog.rst)
Tests. (New test added to
test/plugins/test_convert.pyto assert that--formatforces transcoding even whennever_convert_lossy_filesis enabled.)