fix: ftintitle can handle a list of ampersanded artists (#6375)

This was inspired by real life events:
https://musicbrainz.org/release/7c4d7a15-6b30-4bef-8b20-af200186fbdb by
the artist Danny L Harle has a a track with a featuring list that
contains "Danny L Harle, Oklou & MNEK".

Before:
```
artist = Danny L Harle, Oklou
track = Crystallise My Tears feat. MNEK
```

After:
```
artist = Danny L Harle
track = Crystallise My Tears feat. Oklou & MNEK
```
This commit is contained in:
Šarūnas Nejus 2026-03-02 15:00:05 +00:00 committed by GitHub
commit 6089ab08fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 3 deletions

View file

@ -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(

View file

@ -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
~~~~~~~~~~~~~~~~~~~~~

View file

@ -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)),