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 72.07% 72.13% +0.05%
==========================================
Files 159 159
Lines 20633 20681 +48
Branches 3273 3287 +14
==========================================
+ Hits 14871 14918 +47
+ Misses 5053 5048 -5
- Partials 709 715 +6
🚀 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. |
| Choosing the Right Tool | ||
| ----------------------- | ||
|
|
||
| With multiple ways to filter and map genres, here is a quick guide on when to | ||
| use what: | ||
|
|
||
| - **Aliases**: Use these first to fix spelling variants and abbreviations (e.g., | ||
| ``dnb`` → ``drum and bass``). | ||
| - **Ignorelist**: Use this for error correction when Last.fm results are not | ||
| accurate, or for precise per-artist or global exclusions (e.g., rejecting | ||
| ``Metal`` for specific electronic artists). | ||
| - **Canonicalization**: Use this to automatically map specific sub-genres to | ||
| broader categories (e.g., ``Grindcore`` → ``Metal``). | ||
| - **Whitelist**: Use this to finally limit your library to a predefined set of | ||
| genres. When combined with canonicalization, the plugin will try to map a | ||
| sub-genre to its closest whitelisted parent. Anything else is dropped. | ||
|
|
There was a problem hiding this comment.
Reviewers: This new chapter is a good starting point for reviewing and might help thinking through where and when things should happen in the plugin and why multiple filtering features make sense for this plugin!
87c272c to
b12b314
Compare
133b397 to
67ae26c
Compare
It's ready now @snejus! I also updated the PR description. Please re-read! Thanks! |
Add comment on alias and log in client Refactor aliases load using confuse MappingValues Get rid of drop/norm helper again
which also slightly improves readability after removing the redundant drop_ignore_genres helper.
streamline vars naming in tests
|
Note the tests are failing still! |
Fixed and narrowed some regex along the way. (note that the commit history still is a real mess, I'll clean that up once it's reviewed) |
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>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.ignorelistfeatures' tests.