Conversation
- 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
|
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. |
There was a problem hiding this comment.
Pull request overview
grug see PR add genre ignorelist to lastgenre plugin, so wrong Last.fm tags can be blocked global (*) or per artist. this fit plugin job: pick good genre tags and keep user control.
Changes:
- add ignorelist file parsing + regex/literal compile, plus shared
is_ignored()helper - apply ignorelist both right after Last.fm fetch and again during genre resolve/whitelist/c14n
- add docs + tests for ignorelist matching and file format/errors
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
beetsplug/lastgenre/__init__.py |
load ignorelist from config file; thread artist through resolve path; filter ignored tags during c14n + final validation |
beetsplug/lastgenre/client.py |
filter ignored tags immediately after Last.fm lookup (while keeping cache) |
beetsplug/lastgenre/utils.py |
new shared is_ignored() helper + ignorelist typing |
docs/plugins/lastgenre.rst |
document ignorelist feature + config option |
test/plugins/test_lastgenre.py |
add ignorelist tests (resolve behavior, matcher behavior, file format + errors) |
Comments suppressed due to low confidence (1)
test/plugins/test_lastgenre.py:293
- grug see this
configfixture just return upstream module-scoped config. it not reset state per test, soconfig['lastgenre']['ignorelist'](and other keys) can leak between tests and even breakLastGenrePlugin()init when prior test set ignorelist path then delete file. grug suggest make this fixture actually reset needed keys (ex: setlastgenre.ignorelist = Falsehere) or use function-scoped fresh config object.
@pytest.fixture
def config(config):
"""Provide a fresh beets configuration for every test/parameterize call
This is necessary to prevent the following parameterized test to bleed
config test state in between test cases.
"""
return config
| elif obj.albumartist != config["va_name"].as_str(): | ||
| new_genres = self.client.fetch_artist_genre(obj.albumartist) | ||
| stage_label = "album artist" | ||
| stage_artist = obj.albumartist | ||
| if not new_genres: |
There was a problem hiding this comment.
grug see multi-valued album artist fallback collect genres from many obj.albumartists, but stage_artist stay set to obj.albumartist. then later resolve step apply artist-specific ignorelist for wrong artist and can drop genre that came from other albumartist. grug think when stage_label become "multi-valued album artist", set stage_artist = None (global only) or handle per-artist filtering another way.
| fracture: | ||
| ^(heavy|black|power|death)?\s?(metal|rock)$|\w+-metal\d*$ | ||
| progressive metal |
There was a problem hiding this comment.
grug think regex example in code block wrong: it show double backslash (\\s, \\w, \\d). in ignorelist file user must write single backslash (\s, \w, \d) or regex will match literal "\s" text, not whitespace/word/digit. please change example to single backslashes so copy/paste work.
- 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
1400171 to
c17eebb
Compare
|
@snejus this is now ready for a first (human) review except the copilot comments I will address. Thanks in advance :-) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6449 +/- ##
==========================================
+ Coverage 69.73% 69.82% +0.09%
==========================================
Files 145 146 +1
Lines 18534 18615 +81
Branches 3023 3043 +20
==========================================
+ Hits 12924 12998 +74
- Misses 4976 4979 +3
- Partials 634 638 +4
🚀 New features to boost your workflow:
|
Description
Adds a global and artist-specific genre ignorelist to lastgenre. Ignorelist entries can use regex patterns or literal genre names and are configurable per artist or globally (*). Example:
This avoids incorrect genre assignments for artists with overlapping names (e.g., “Fracture” the DnB producer vs a Metal band)..
Why invent a file format?
YAML and INI formats were tested but proved cumbersome for regex patterns. A simple custom format is user-friendly and allows all regex patterns without special escaping or formatting.
Further notes
My personal roadmap for the
lastgenreplugin: #5915Feature idea originated from: #5721 (comment).
To Do