Feat: Smartplaylist: Add dest_regen option for regenerating destination path #5621
Conversation
There was a problem hiding this comment.
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()
fd61dc5 to
f05ac9e
Compare
|
Hello @snejus ! :) Rebasing on master and writing of a test to test the |
58eeb07 to
d0af4c0
Compare
|
Rebased on master for |
d0af4c0 to
d296312
Compare
d296312 to
c15e91e
Compare
|
Hello @snejus , I rebased the branch on |
|
GitHub had an incident with Actions last night, but this should be resolved now. Try And force pushing, let's see whether it works now? |
6030cfd to
5aca83a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5621 +/- ##
=======================================
Coverage 69.55% 69.55%
=======================================
Files 141 141
Lines 18494 18498 +4
Branches 3025 3026 +1
=======================================
+ Hits 12863 12867 +4
Misses 4995 4995
Partials 636 636
🚀 New features to boost your workflow:
|
|
Hi @snejus , this branch has been rebased on master and tests / documentation was reworked to fix all errors and adopt last coding conventions / API change since the last work on it (which was may last year ahah). Everything should be ready to merge IMHO, feel free to raise suggestions if any. Thanks. :) |
|
@pierreay thanks for this! Now that it's all in place I'll have a look at it, starting with Copilot! |
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`
The aforementioned commits introduced a nmuber of changes since I implemented this test: - The syntax `self.assertExists(m3u_filepath)` was an old and now invalid way of checking existence of a path using assertion, change to `assert m3u_filepath.exists()` which now use string instead of bytes - Use of `Path()` and strings instead of `path.join` and bytes for handling directory path
Styling by Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Rephrasing by Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
be3c98c to
49cb2f5
Compare
|
Ah, I recently added a new CI check which now failed! |
Head branch was pushed to by a user without write access
|
Sure, the changelog is fixed! Ready to be merged ;) |
Problem
-C -Moptions), they will be registered inside the Beets database using their original paths. However, during subsequent processing (e.g., aconvertoperation), a path following the Beets path format can be generated.smartplaylistplugin, 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 equivalentdest-regenon the CLI) to regenerate items' path in the generated playlist instead of using the ones of the library, just like aconvertor amoveoperation would have done. This operation will happen before therelative_toandprefixoptions, 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_toandprefix). It is then helpful to generate playlists compatible with theconvertplugin.To Do