diff --git a/beetsplug/ftintitle.py b/beetsplug/ftintitle.py index fde7ff92a..362bab523 100644 --- a/beetsplug/ftintitle.py +++ b/beetsplug/ftintitle.py @@ -71,6 +71,12 @@ def split_on_feat( if len(parts) == 2: return parts + # Try comma as separator + # (e.g. "Alice, Bob & Charlie" where Bob and Charlie are featuring) + if for_artist and "," in artist: + comma_parts = artist.split(",", 1) + return comma_parts[0].strip(), comma_parts[1].strip() + # Fall back to all tokens including generic separators if no explicit match if for_artist: regex = re.compile( diff --git a/docs/changelog.rst b/docs/changelog.rst index 6cd8d7623..8bbe8f4ea 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -36,9 +36,11 @@ New features 3. Comma followed by a space 4. Slash wrapped by spaces -.. - Bug fixes - ~~~~~~~~~ +Bug fixes +~~~~~~~~~ + +- :doc:`plugins/ftintitle`: Fix handling of multiple featured artists with + ampersand. For plugin developers ~~~~~~~~~~~~~~~~~~~~~ diff --git a/test/plugins/test_ftintitle.py b/test/plugins/test_ftintitle.py index 560f44402..2bba41ad0 100644 --- a/test/plugins/test_ftintitle.py +++ b/test/plugins/test_ftintitle.py @@ -324,6 +324,11 @@ def test_find_feat_part( ("Alice feat. Bob", ("Alice", "Bob")), ("Alice featuring Bob", ("Alice", "Bob")), ("Alice & Bob", ("Alice", "Bob")), + ("Alice, Bob & Charlie", ("Alice", "Bob & Charlie")), + ( + "Alice, Bob & Charlie feat. Xavier", + ("Alice, Bob & Charlie", "Xavier"), + ), ("Alice and Bob", ("Alice", "Bob")), ("Alice With Bob", ("Alice", "Bob")), ("Alice defeat Bob", ("Alice defeat Bob", None)),