Add parentheses as delimiters for feat. detection

When checking whether a title or artist contains a feature, it now also
detects them when they are in parentheses or brackets, i.e., "Song Name
(feat. XYZ)" will return true.
This commit is contained in:
Karl Besser 2024-09-20 22:59:59 -04:00
parent 88d3f040e1
commit 8c60d2b960

View file

@ -518,7 +518,7 @@ def feat_tokens(for_artist=True):
feat_words = ["ft", "featuring", "feat", "feat.", "ft."]
if for_artist:
feat_words += ["with", "vs", "and", "con", "&"]
return r"(?<=\s)(?:{})(?=\s)".format(
return r"(?<=[\s,(,\[])(?:{})(?=\s)".format(
"|".join(re.escape(x) for x in feat_words)
)