lastgenre: Genre spelling normalization (aliases)#6466
Open
JOJ0 wants to merge 17 commits intolastgenre_forbiddenfrom
Open
lastgenre: Genre spelling normalization (aliases)#6466JOJ0 wants to merge 17 commits intolastgenre_forbiddenfrom
JOJ0 wants to merge 17 commits intolastgenre_forbiddenfrom
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 @@
## lastgenre_forbidden #6466 +/- ##
=======================================================
+ Coverage 70.19% 70.25% +0.06%
=======================================================
Files 148 148
Lines 18612 18661 +49
Branches 3035 3050 +15
=======================================================
+ Hits 13064 13111 +47
+ Misses 4913 4909 -4
- Partials 635 641 +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. |
Member
Author
JOJ0
commented
Mar 29, 2026
Comment on lines
+252
to
+268
| 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. | ||
|
|
Member
Author
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
3866f73 to
d2b0e00
Compare
- Test file format (valid and error cases) - Test regex pattern matching (_is_ignored) - Test _resolve_genres: ignored genres filtered - Test _resolve_genres: c14n ancestry walk blocked for ignored tags - Test _resolve_genres: without whitelist, oldest ancestor is kept - Test _resolve_genres: whithout whitelist, ignored oldest ancestor is removed
- Prevents wrong last.fm genres based on a per artist (or global) list of regex
patterns that should be ignored.
- Genre _ignoring_ happens in two places: Right after fetching the
last.fm genre and in _resolve_genres.
- As a fallback literal string matching can be used instead of
supplying a regex pattern
- Includes docs for the new feature.
and fix fallback types
and compile regex inline. extra_debug is now better readable
6536937 to
46bde5e
Compare
efd7657 to
53f2435
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Requires #6449 to be merged first!
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 fetching/caching) and the core_resolve_genresloop (for uniform processing of existing file tags).