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

Feat: Smartplaylist: Add dest_regen option for regenerating destination path #5621

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

Conversation

pierreay
Copy link

@pierreay pierreay commented Feb 8, 2025

Problem

  1. When items are imported into the library in a don't copy-move mode (-C -M options), they will be registered inside the Beets database using their original paths. However, during subsequent processing (e.g., a convert operation), a path following the Beets path format can be generated.
  2. When generating playlists using smartplaylist plugin, only the path registered inside the Beets database (the original path) can be use inside the output playlist. This block the compatibility with other plugins.

Solution

I added a a new optional configuration option known as dest_regen (as well as its equivalent dest-regen on the CLI) to regenerate items' path in the generated playlist instead of using the ones of the library, just like a convert or a move operation would have done. This operation will happen before the relative_to and prefix options, which makes sense to do so and not in another order, otherwise this new option (dest_regen)) would overwrite the desired behavior of the other mentioned options (relative_to and prefix). It is then helpful to generate playlists compatible with the convert plugin.

To Do

  • Documentation
  • Changelog
  • Tests. (I may write one in the future if this PR is considered)

@snejus snejus requested a review from Copilot March 20, 2025 21:33
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new configuration option "dest_regen" (with its CLI alias "--dest-regen") to support regenerating the destination path for playlist items, thereby improving compatibility with the convert plugin.

  • Introduces a configuration flag "dest_regen" with a default of False.
  • Adds a corresponding CLI option "--dest-regen".
  • Updates the playlist update logic to optionally use the item's regenerated destination path.
Files not reviewed (2)
  • docs/changelog.rst: Language not supported
  • docs/plugins/smartplaylist.rst: Language not supported
Comments suppressed due to low confidence (1)

beetsplug/smartplaylist.py:267

  • The new dest_regen functionality is not covered by tests; please add tests to ensure that the regenerated destination path is correctly handled under various configurations.
dest_regen = self.config["dest_regen"].get()

Pierre Ayoub and others added 5 commits March 22, 2025 10:24
Test functions inspired from `test_playlist_update_output_extm3u()` in
`test_smartplaylist.py`.
Test successfully passed using:
`poetry run pytest test/plugins/test_smartplaylist.py`
@pierreay pierreay force-pushed the pr-feat-smartplaylist-path-regen branch from fd61dc5 to f05ac9e Compare March 22, 2025 09:34
@pierreay
Copy link
Author

Hello @snejus ! :) Rebasing on master and writing of a test to test the dest_regen feature logic is done!

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