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.46% 72.53% +0.06%
==========================================
Files 161 161
Lines 20719 20767 +48
Branches 3280 3295 +15
==========================================
+ Hits 15014 15063 +49
+ Misses 4979 4973 -6
- Partials 726 731 +5
🚀 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
streamline vars naming in tests
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
and fix and extend related docs
|
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! |
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.