Skip to content

lastgenre: Album stage fall back to multi-valued albumartists - #6893

Open
JOJ0 wants to merge 3 commits into
lastgenre_improve_original_fallbackfrom
lastgenre_album_albumartists_fallback
Open

lastgenre: Album stage fall back to multi-valued albumartists#6893
JOJ0 wants to merge 3 commits into
lastgenre_improve_original_fallbackfrom
lastgenre_album_albumartists_fallback

Conversation

@JOJ0

@JOJ0 JOJ0 commented Jul 30, 2026

Copy link
Copy Markdown
Member

Description

Fixes: #6238

If last.fm returns no album genres for albumartist, fall back to querying the album against each artist in albumartists (falling through to the artist stage if that also yields nothing.)

The album stage reasoning is now slightly more complex and was moved to its own helper method.

Note: Requires #6474

To Do

  • Documentation.
  • Changelog.
  • Tests.

@github-actions

Copy link
Copy Markdown

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.

@JOJ0 JOJ0 changed the title temp commit for cherry-pick lastgenre: Album stage fall back to multi-valued albumartists Jul 30, 2026
@github-actions github-actions Bot added the lastgenre lastgenre plugin label Jul 30, 2026
@JOJ0 JOJ0 mentioned this pull request Jul 30, 2026
3 tasks
@JOJ0
JOJ0 force-pushed the lastgenre_album_albumartists_fallback branch from 58675e5 to 054d241 Compare August 2, 2026 17:36
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.68%. Comparing base (e2f60a5) to head (e8e5265).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
beetsplug/lastgenre/__init__.py 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           lastgenre_refactor_get_genre    #6893   +/-   ##
=============================================================
  Coverage                         75.67%   75.68%           
=============================================================
  Files                               163      163           
  Lines                             21418    21430   +12     
  Branches                           3385     3388    +3     
=============================================================
+ Hits                              16209    16219   +10     
- Misses                             4410     4411    +1     
- Partials                            799      800    +1     
Files with missing lines Coverage Δ
beetsplug/lastgenre/__init__.py 82.00% <93.33%> (+0.75%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JOJ0
JOJ0 force-pushed the lastgenre_album_albumartists_fallback branch from 054d241 to 08557bd Compare August 2, 2026 21:08
@JOJ0
JOJ0 marked this pull request as ready for review August 2, 2026 21:36
@JOJ0
JOJ0 requested a review from a team as a code owner August 2, 2026 21:36
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

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.

@JOJ0
JOJ0 force-pushed the lastgenre_album_albumartists_fallback branch from 251def4 to e8e5265 Compare August 5, 2026 06:10
@JOJ0
JOJ0 changed the base branch from lastgenre_refactor_get_genre to lastgenre_better_existing_fallback August 5, 2026 06:49
JOJ0 added 3 commits August 5, 2026 08:50
Try and concatinate genres of each member of albumartists in the
multi-valued field if no genre for the main albumartist could be found.
@JOJ0
JOJ0 force-pushed the lastgenre_album_albumartists_fallback branch from e8e5265 to 95086dc Compare August 5, 2026 06:50
@JOJ0
JOJ0 changed the base branch from lastgenre_better_existing_fallback to lastgenre_improve_original_fallback August 5, 2026 06:52
@JOJ0
JOJ0 requested a lite review from Copilot August 5, 2026 06:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

PR make lastgenre album stage smarter for multi-artist albums. When Last.fm give no album tags for main albumartist, plugin now try album lookup for each value in multi-valued albumartists, then still fall through to artist stage if nothing found.

Changes:

  • Add _try_resolve_album_stage helper to hold album-stage logic and multi-valued albumartists fallback.
  • Add focused unit test that exercises per-albumartist album lookup fallback.
  • Document new multi-artist album behavior in lastgenre docs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
beetsplug/lastgenre/__init__.py Add album-stage helper that falls back to per-albumartists album lookups when primary album lookup empty.
test/plugins/test_lastgenre.py Add direct test for _try_resolve_album_stage fallback behavior.
docs/plugins/lastgenre.rst Document album-stage fallback to multi-valued albumartists before artist source.

Comment on lines +528 to +533
resolved := self._try_resolve_stage(
"multi-valued albumartist album",
keep_genres,
multi_album_genres,
artist=None,
)
Comment on lines +738 to +741
assert plugin._try_resolve_album_stage(item, []) == (
["Rock"],
"multi-valued albumartist album, any",
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lastgenre lastgenre plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants