Skip to content

Commit e1980f2

Browse files
j0j0JOJ0
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 6f457c0 commit e1980f2

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
@@ -422,6 +422,19 @@ def _try_resolve_stage(stage_label: str, keep_genres, new_genres):
422422
elif obj.albumartist != config["va_name"].as_str():
423423
new_genres = self.fetch_artist_genre(obj.albumartist)
424424
stage_label = "album artist"
425+
if not new_genres:
426+
self._tunelog(
427+
'No album artist genre found for "{}", '
428+
"trying multi-valued field...",
429+
obj.albumartist,
430+
)
431+
for albumartist in obj.albumartists:
432+
self._tunelog(
433+
'Fetching artist genre for "{}"', albumartist
434+
)
435+
new_genres += self.fetch_artist_genre(albumartist)
436+
if new_genres:
437+
stage_label = "multi-valued album artist"
425438
else:
426439
# For "Various Artists", pick the most popular track genre.
427440
item_genres = []

0 commit comments

Comments
 (0)