Skip to content

Commit 4a0ff5d

Browse files
j0j0j0j0
authored andcommitted
lastgenre: Use multi-valued albumartists field
In case the albumartist genre can't be found (often due to variations of artist-combination wording issues, eg "featuring", "+", "&" and so on) use the albumartists list field, fetch a genre for each artist separately and concatenate them.
1 parent 3838c5a commit 4a0ff5d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

beetsplug/lastgenre/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,19 @@ def _try_resolve_stage(stage_label: str, keep_genres, new_genres):
420420
elif obj.albumartist != config["va_name"].as_str():
421421
new_genres = self.fetch_artist_genre(obj.albumartist)
422422
stage_label = "album artist"
423+
if not new_genres:
424+
self._tunelog(
425+
'No album artist genre found for "{}", '
426+
"trying multi-valued field...",
427+
obj.albumartist,
428+
)
429+
for albumartist in obj.albumartists:
430+
self._tunelog(
431+
'Fetching artist genre for "{}"', albumartist
432+
)
433+
new_genres += self.fetch_artist_genre(albumartist)
434+
if new_genres:
435+
stage_label = "multi-valued album artist"
423436
else:
424437
# For "Various Artists", pick the most popular track genre.
425438
item_genres = []

0 commit comments

Comments
 (0)