Skip to content

lastgenre: Apply canonicalization to genres of items with no Last.fm results#6383

Open
Bergbok wants to merge 4 commits intobeetbox:masterfrom
Bergbok:lastgenre-canonicalize-fix
Open

lastgenre: Apply canonicalization to genres of items with no Last.fm results#6383
Bergbok wants to merge 4 commits intobeetbox:masterfrom
Bergbok:lastgenre-canonicalize-fix

Conversation

@Bergbok
Copy link

@Bergbok Bergbok commented Feb 20, 2026

I've been configuring my canonicalization tree to remove tags I don't like, essentially using it like a blacklist, and noticed some tags not being removed after re-running the lastgenre command.

The reason for this is that when keep_existing is enabled and no Last.fm results are found, the existing genres are returned as-is without being processed through _resolve_genres(). This means existing genres that should be filtered by the canonicalization tree are kept unchanged.

As an example, if I had this in my canonicalization tree:

- '':
  - 'some tag'

and then ran lastgenre on a track with 'some tag', but which had no data on Last.fm, it wouldn't get removed from the track. This PR fixes that.

@Bergbok Bergbok requested a review from a team as a code owner February 20, 2026 22:50
@Bergbok Bergbok force-pushed the lastgenre-canonicalize-fix branch from 1061f9d to c08f473 Compare February 20, 2026 22:53
@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.97%. Comparing base (83f1671) to head (67f7658).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6383      +/-   ##
==========================================
+ Coverage   68.96%   68.97%   +0.01%     
==========================================
  Files         140      140              
  Lines       18685    18683       -2     
  Branches     3056     3055       -1     
==========================================
+ Hits        12886    12887       +1     
+ Misses       5155     5154       -1     
+ Partials      644      642       -2     
Files with missing lines Coverage Δ
beetsplug/lastgenre/__init__.py 71.00% <100.00%> (+0.89%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Bergbok Bergbok force-pushed the lastgenre-canonicalize-fix branch from c08f473 to 67f7658 Compare February 21, 2026 06:44
@JOJ0
Copy link
Member

JOJ0 commented Feb 21, 2026

I've been configuring my canonicalization tree to remove tags I don't like, essentially using it like a blacklist, and noticed some tags not being removed after re-running the lastgenre command.

A blacklist feature is in the pipeline but it will take a while until it's ready. 2 other lastgenre PR's need to go first. You could test from the branch but I suggest with a test library setup only for now: #5744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants