lastgenre: Genre spelling normalization (aliases) - #6466
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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6466 +/- ##
==========================================
+ Coverage 74.91% 74.97% +0.06%
==========================================
Files 163 163
Lines 21176 21209 +33
Branches 3342 3349 +7
==========================================
+ Hits 15863 15902 +39
+ Misses 4546 4538 -8
- Partials 767 769 +2
🚀 New features to boost your workflow:
|
20b2d88 to
90064fa
Compare
66a7d98 to
1785dab
Compare
1785dab to
c5a14d3
Compare
d0cc527 to
12e7358
Compare
|
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. |
87c272c to
b12b314
Compare
afe7c06 to
000ff8f
Compare
|
Hi @snejus I commented inline (sorry it's pretty messy here already :-/) addressed all suggestions and I am happy with the result. Please have a (hopefully final) look :-) Note to myself: I'll probably simply squash all the commits or maybe reset and recommit everything so at least changes not directly involved with this new feature stay separate! |
9ec1221 to
21908b9
Compare
|
@snejus adressed all the code suggestions. That part is ready to merge I think. What do you think of this change? 1ccdc2d What should we do about Anything else left to do? You might want to review the changelog. Tried to explain what the goal was with default aliases and genre changes. What do you think of this future feature ideas? It might address the real issues here:
And another one, which could make life easier for the user? Not sure:
|
Seems like |
|
Thanks, I had another look. Regarding There are still three failing tests, by the way: The changelog makes sense to me. However, I'd probably avoid saying that the files were "audited" and that long-standing mismatches were "resolved" since this sounds a bit too definitive. I'd simply say that the default aliases normalize common Last.fm spelling and naming variants and that the whitelist and genre tree were updated with additional common Last.fm tags. Regarding the future features:
Makes sense!
This also makes sense to me and is probably simpler. Maybe a separate I don't think either of these needs to be part of this PR. |
|
Hi @snejus thanks for the last feedback on future ideas (yes future as in separate feature requests), and for the finalization: As we discussed internally, let's keep everything as minimal and limited to spelling correction / and obvious duplication fixes only. Please go ahead and push a commit if you find the time. I'll fix all tests once that's done. |
|
See #6823 |
- Genre alias normalization feature implementation - Extend and simplify _filter_valid() - Remove drop_ignored_genres() - More smaller ignorelist related refactoring
client and main plugin classes use the same names for instance variables now
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
even though it's indirectly tested via resolve_genres tests and elsewhere, it makes sense to keep them to help with future refactoring.
- Document the genre alias normalization feature and the default aliases we ship with the plugin (by using rst "literalinclude" referring to aliases.yaml directly) - Clarify what canonicalization acutually does when used without a whitelist enabled. - New docs chapter "Using the right tool"
- Fixes some inconsistencies in spelling in the data files we ship with
the plugin as well as adds some new genres to both files that seem to
be returned often by last.fm.
- For some changes the default aliases feature helps to streamline
inconsistencies that come from last.fm already.
- The default aliases file that ships with beets
- Tests fixes that prove that most of the alias normalization patterns
work as they are supposed to.
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
Wohoo! It's merged! Thanks for the support! ❤️ |
Description
This PR introduces a regex-based normalization (alias) system to unify variant genre tags and improves the plugin's documentation.
The normalization feature uses an ordered list of regular expression aliases to map variant spellings or synonyms to a single canonical name. The mapping keys act as
re.Match.expand()templates, supporting\g<N>(or shorter, eg.\1) back-references to regex capture groups:normalize_genrebeforeis_ignoredin both theLastFmClient(for clean lookup/filtering) and the core_resolve_genresloop (for uniform processing of existing file tags).aliases.yamlfrom the top 1,000 Last.fm tags to cover common inconsistencies without over-normalizing.beet -vvv ...)ignorelistfeatures' tests.IgnorePatternsByArtist