-
Notifications
You must be signed in to change notification settings - Fork 1.9k
lastgenre: Fix fetching artist genre for multi-artist albums #5981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Reviewer's GuideIntroduces splitting logic for multi-artist album names: a new helper method fetch_split_album_artist_genre wraps the existing API lookup, and _try_resolve_stage is extended to detect configured separators, split the albumartist string, and aggregate each artist’s genre. Sequence diagram for multi-artist album genre fetchingsequenceDiagram
participant Plugin as LastGenrePlugin
participant Album as Album
participant LastFM as LASTFM
Plugin->>Album: Get albumartist
Plugin->>Plugin: Check for separators in albumartist
alt Separators found
Plugin->>Plugin: Split albumartist into individual artists
loop For each split artist
Plugin->>LastFM: get_artist(split_artist)
LastFM-->>Plugin: Return genre
Plugin->>Plugin: Aggregate genre
end
else No separators found
Plugin->>LastFM: get_artist(albumartist)
LastFM-->>Plugin: Return genre
end
Plugin->>Album: Assign aggregated genre(s)
Class diagram for updated LastGenrePlugin methodsclassDiagram
class LastGenrePlugin {
+fetch_album_artist_genre(obj)
+fetch_split_album_artist_genre(split_artist)
+fetch_artist_genre(item)
+_try_resolve_stage(stage_label, keep_genres, new_genres)
}
LastGenrePlugin : fetch_split_album_artist_genre(split_artist)
LastGenrePlugin : _try_resolve_stage(stage_label, keep_genres, new_genres)
LastGenrePlugin : fetch_album_artist_genre(obj)
LastGenrePlugin : fetch_artist_genre(item)
LastGenrePlugin --> LASTFM : get_artist(artist_name)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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. |
86e07aa
to
2a27349
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5981 +/- ##
==========================================
- Coverage 66.50% 66.38% -0.13%
==========================================
Files 117 117
Lines 18123 18141 +18
Branches 3071 3081 +10
==========================================
- Hits 12052 12042 -10
- Misses 5415 5444 +29
+ Partials 656 655 -1
🚀 New features to boost your workflow:
|
2a27349
to
29fac0d
Compare
Often last.fm does not have artist genres for delimiter-separated artist names (eg. "Artist One, Artist Two"). This splits out by (the configured) delimiter and gathers each artist's last.fm genre. FIXME: It would be cool if a configured list of artist name separators would be used instead of a hard-coded one.
c7fec68
to
58463f0
Compare
- Move albumartist splitting to separator method - Default separators without whitespace, handle in method - Use word boundaries for alnum seps and no boundaries for symbols
before trying any string splitting, log accordingly.
58463f0
to
314a914
Compare
Often last.fm does not have artist genres for delimiter-separated artist names (eg. "Artist One, Artist Two"). This splits out by (the configured) delimiter and gathers each artist's last.fm genre.
FIXME: It would be cool if a configured list of artist name separators would be used instead of a hard-coded one.
Description
Fixes #X.
To Do
Summary by Sourcery
Enhance album genre lookup to handle multi-artist album artists by splitting the albumartist string on configured and common separators, then aggregating each sub-artist’s genres from Last.fm.
New Features:
Enhancements: