Skip to content

Commit 1a59368

Browse files
authored
Add detection of "feat. X" parts in parentheses; Fix #5436 (#5437)
2 parents 88d3f04 + 5aa96aa commit 1a59368

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

beets/plugins.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def feat_tokens(for_artist=True):
518518
feat_words = ["ft", "featuring", "feat", "feat.", "ft."]
519519
if for_artist:
520520
feat_words += ["with", "vs", "and", "con", "&"]
521-
return r"(?<=\s)(?:{})(?=\s)".format(
521+
return r"(?<=[\s(\[])(?:{})(?=\s)".format(
522522
"|".join(re.escape(x) for x in feat_words)
523523
)
524524

docs/changelog.rst

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ New features:
2626

2727
Bug fixes:
2828

29+
* The detection of a "feat. X" part now also matches such parts if they are in
30+
parentheses or brackets. :bug:`5436`
2931
* Improve naming of temporary files by separating the random part with the file extension.
3032
* Fix the ``auto`` value for the :ref:`reflink` config option.
3133
* Fix lyrics plugin only getting part of the lyrics from ``Genius.com`` :bug:`4815`

test/plugins/test_ftintitle.py

+5
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,10 @@ def test_contains_feat(self):
183183
assert ftintitle.contains_feat("Alice & Bob")
184184
assert ftintitle.contains_feat("Alice and Bob")
185185
assert ftintitle.contains_feat("Alice With Bob")
186+
assert ftintitle.contains_feat("Alice (ft. Bob)")
187+
assert ftintitle.contains_feat("Alice (feat. Bob)")
188+
assert ftintitle.contains_feat("Alice [ft. Bob]")
189+
assert ftintitle.contains_feat("Alice [feat. Bob]")
186190
assert not ftintitle.contains_feat("Alice defeat Bob")
187191
assert not ftintitle.contains_feat("Aliceft.Bob")
192+
assert not ftintitle.contains_feat("Alice (defeat Bob)")

0 commit comments

Comments
 (0)