Skip to content

Commit 314a914

Browse files
committed
lastgenre: Use albumartists multi-valued field
before trying any string splitting, log accordingly.
1 parent 5ea12d2 commit 314a914

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

beetsplug/lastgenre/__init__.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"featuring",
4949
"&",
5050
"vs.",
51-
"x", # Match "x" only as whole word
51+
"x",
5252
"/",
5353
"+",
5454
"and",
@@ -467,16 +467,22 @@ def _try_resolve_stage(stage_label: str, keep_genres, new_genres):
467467
'No album artist genre found for "{0.albumartist}"',
468468
obj,
469469
)
470-
# Try splitting on separators for multi-artist albums
471-
albumartists = split_on_separators(
470+
471+
# Try multi-valued field first, fallback to separator splitting
472+
albumartists = obj.get(
473+
"albumartists", []
474+
) or split_on_separators(
472475
obj.albumartist,
473-
separators=self.config["artist_separators"].as_str_seq()
476+
self.config["artist_separators"].as_str_seq(),
477+
)
478+
479+
split_method = (
480+
"albumartists"
481+
if obj.get("albumartists", [])
482+
else "albumartists sep-split"
474483
)
484+
475485
if len(albumartists) > 1:
476-
if self.config["extended_debug"]:
477-
self._log.debug(
478-
"Found separators in album artist - splitting..."
479-
)
480486
for albumartist in albumartists:
481487
if self.config["extended_debug"]:
482488
self._log.debug(
@@ -486,8 +492,8 @@ def _try_resolve_stage(stage_label: str, keep_genres, new_genres):
486492
new_genres += self.fetch_split_album_artist_genre(
487493
albumartist
488494
)
489-
if new_genres:
490-
stage_label = "album artist (split)"
495+
if new_genres:
496+
stage_label = f"{split_method}"
491497
else:
492498
# For "Various Artists", pick the most popular track genre.
493499
item_genres = []

0 commit comments

Comments
 (0)