[LastGenre] Canonicalize existing genres#6317
Conversation
|
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. |
4296305 to
64a9c41
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements a new canonicalize_existing configuration flag for the lastgenre plugin to enable whitelist canonicalization of existing genres when force: no, canonical: yes, and whitelist: yes are set.
Changes:
- Adds a new
canonicalize_existingboolean configuration option with a default value ofFalse - Updates the genre resolution logic to canonicalize existing genres before returning them when the new flag is enabled
- Adds documentation explaining the new flag's behavior and requirements
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| beetsplug/lastgenre/init.py | Adds the canonicalize_existing config option and implements canonicalization logic for existing genres |
| docs/plugins/lastgenre.rst | Documents the new canonicalize_existing configuration option |
| docs/changelog.rst | Adds changelog entry for the new feature |
| test/plugins/test_lastgenre.py | Adds test case to verify canonicalization of existing genres |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
docs/plugins/lastgenre.rst
Outdated
| - **canonicalize_existing**: This option only takes effect with ``force: no``, | ||
| ``canonical: yes`` and ``whitelist: yes``. | ||
| Setting this to ``yes``, will result in attempted canonicalization of existing | ||
| genres. If this fails, the ``fallback`` is used. Default: ``no`` (disabled). |
There was a problem hiding this comment.
The documentation should clarify what 'fails' means in this context. Does it mean no canonical genres are found, or that the canonicalization process encounters an error? This ambiguity could confuse users.
| genres. If this fails, the ``fallback`` is used. Default: ``no`` (disabled). | |
| genres. If canonicalization cannot be applied or does not produce a canonical | |
| genre (for example, because no mapping is found or an error occurs), the | |
| ``fallback`` is used instead. Default: ``no`` (disabled). |
There was a problem hiding this comment.
This really doesn't match the style of the remaining documentation + it's overly verbose.
For the user the inner workings aren't really important.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6317 +/- ##
==========================================
- Coverage 68.87% 68.86% -0.01%
==========================================
Files 140 140
Lines 18666 18673 +7
Branches 3063 3066 +3
==========================================
+ Hits 12856 12859 +3
- Misses 5162 5165 +3
- Partials 648 649 +1
🚀 New features to boost your workflow:
|
1c99cf1 to
c796161
Compare
Introduce a new lastgenre `canonicalize_existing` flag. It handles the case where canonicalization is desired on existing tags. The new logic triggers if: - `force`: False - `whitelist`: True - `canonical`: True - `canonicalize_existing: True
c796161 to
c5eb470
Compare
|
Hm interesting feature and useful, but I'm not sure if this should maybe be called something containing the word "cleanup". It might even include whitelist filtering without canonicalization too. I see it as a "cleanup existing only" kind of functionality. And are you sure this can't be included in the force branch somehow? We are moving away from force:no being what one would expect from it. let's brainstorm some more here please |
|
@Nukesor I adjusted my wording above slightly. I think it was weird. Maybe still is... |
|
I didn't read your first response, but the edited doesn't seem weird at all :D
The force-branch already canonicalizes local genres (if
It's more of a "cleanup stuff from lastfm, but please also cleanup local stuff that isn't force-overwritten/merged" :D Regarding "cleanup", I would be up for it, although I think that canonicalization better conveys what actually happens. If we were to change the wording, we should do it for the whole plugin though.
Neat. How would that look like? |
Description
Fixes #6305
Implements a new
canonicalize_existingconfig flag. The added documentation should explain its behavior. If there're any unclarities, we need to adjust the docs :)To Do