Skip to content

Conversation

@GuyBloom
Copy link

@GuyBloom GuyBloom commented Nov 18, 2025

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:

  • Threads information about whether --format was provided on the CLI down
    into the convert plugin.

  • Allows an explicit --format to override never_convert_lossy_files for
    beet convert, so lossy files selected by the query are transcoded to the
    requested format.

  • Keeps existing behavior for automatic conversion on import (no CLI
    override there).

  • Adds a regression test in NeverConvertLossyFilesTest to 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.py to assert that --format forces transcoding even when never_convert_lossy_files is enabled.)

@GuyBloom GuyBloom requested a review from a team as a code owner November 18, 2025 21:42
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@GuyBloom
Copy link
Author

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.
The error message indicates: "Failed to fetch pull request branch. Please ensure 'persist-credentials' is set to 'true' when checking out the repository."
Looking at the logs, the tj-actions/changed-files@v46 action can't fetch the PR branch history. This might need a fix in the workflow file to add persist-credentials: true to the checkout step.
Could someone with write access take a look? Happy to help test any fixes if needed!

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.
Copy link
Member

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.

Copy link
Author

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

@GuyBloom GuyBloom requested a review from JOJ0 November 21, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

beet convert --format <format> does not override convert: never_convert_lossy_files: yes (it should)

2 participants