Skip to content
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

Convert plugin: Update auto_keep to respect no_convert/never_convert_lossy_files in configuration #5556

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

frigginbrownie
Copy link

@frigginbrownie frigginbrownie commented Dec 19, 2024

Description

According to the docs, the auto_keep function will "Convert your files automatically on import to dest but import the non transcoded version." This is true but not 100% accurate. In cases where no conversion is required (say, importing lossy files where there's no need to convert), auto_keep will copy the files to dest.

This behavior results in duplicate files being created on import when the auto_keep function is set to yes - a lossy file will be imported into the default directory (say /music) and then copied to the dest location (say /transcodes).

This is ideal if you wish to have all music formats in your default directory (lossy and lossless) and all lossy files (original imports and transcodes) in a secondary directory (say /lossy).

But what if you want a separate directory of all music you've transcoded? auto_keep won't provide that, as it copies lossy files to the dest location. In addition, if the dest is set to the same location as default directory, auto_keep will copy lossy files into the same directory that beets previously imported files into, resulting in the directory having two files for each file in an album. If you use paths (say to have singletons imported into /music/singles), auto_keep will import the file into the path location, then copy the file to the dest, creating directories to match the path.

Unlike with the auto option or using "beet convert", auto_keep does not follow the never_convert_lossy_files or no_convert options and will not validate whether files need to be converted or copied on import to dest - it transcodes or it copies, no questions asked.

This change updates the auto_convert_keep function to filter items using should_transcode. This way, if the user sets never_convert_lossy_files to no or no_convert: 'format:mp3', lossy files will not be copied to the dest, while lossless files will be converted to the dest (perfect for a seperate /transcodes directory). If the user sets never_convert_lossy_files to yes, lossy files will to be copied to the dest and lossless files will be converted to the dest (perfect for a /lossy directory). In turn, this change makes behavior consistent with "beet convert" and the auto option.

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

Copy link

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

Fixed linting.
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.

1 participant