Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftintitle: False positives in "feat. X" detection #5441

Closed
klb2 opened this issue Sep 26, 2024 · 0 comments · Fixed by #5442
Closed

ftintitle: False positives in "feat. X" detection #5441

klb2 opened this issue Sep 26, 2024 · 0 comments · Fixed by #5442

Comments

@klb2
Copy link
Contributor

klb2 commented Sep 26, 2024

Problem

The ftintitle plugin has the contains_feat function to check whether a given title already contains a "feat. X" part. The regex used for pattern matching is defined in the feat_tokens function in beets/plugins.py.

In the default call of feat_tokens(), this adds possible feat_words like "and" and "with". This can yield to false positives in the feature detection as shown in the following example:

>>> from beetsplug import ftintitle
>>> ftintitle.contains_feat("Live and Let Go")
True

However, this is simply the title of the song and does not contain a "feat. X" part. (The "and" in the title is detected and matched in the regex.)

The consequence of this is that the ftintitle plugin will actually not add the actual "feat. X" part to the title as it thinks it already contains one.

Fix

I believe the issue is that in ftintitle.contains_feat, the regex is constructed using plugins.feat_tokens(), which sets for_artist=True. A fix would be to change this to plugins.feat_tokens(for_artist=False) as we are matching song titles and not artist.

Setup

  • OS: Linux
  • Python version: 3.12
  • beets version: master branch @ 1a59368
klb2 added a commit to klb2/beets that referenced this issue Sep 30, 2024
Add references to the ftintitle plugin for the bug fixes beetbox#5441 and beetbox#5436
that are related to this plugin.
snejus added a commit that referenced this issue Oct 1, 2024
Fixes #5441 

This small change explicitly passes the `for_artist` keyword to the
`plugins.feat_tokens` function that constructs the regex for matching
existing "feat. X" parts in song titles.
Previously, it was not passed and set to the default (`True`), which
caused using the pattern intended for the artist field to also be used
for the title field.
This caused some false positives as shown in #5441
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant