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: Fix false positives in "feat. X" detection in title #5442

Merged
merged 8 commits into from
Oct 1, 2024

Conversation

klb2
Copy link
Contributor

@klb2 klb2 commented Sep 26, 2024

Description

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

To Do

  • Documentation.
  • Changelog.
  • Tests.

The old version of the `ftintitle.contains_feat` function could lead to
false positives by matching words like "and" and "with" in the title,
even if there was no "feat. X" part.
With this commit, the `for_artist` keyword is explicitly passed to the
`plugins.feat_tokens` function to disable these matches when matching a
title (and not an artist).
The unit tests for the `ftintitle.contains_feat` function are now split
up for artist and title matching.
docs/changelog.rst Outdated Show resolved Hide resolved
beetsplug/ftintitle.py Outdated Show resolved Hide resolved
test/plugins/test_ftintitle.py Outdated Show resolved Hide resolved
klb2 and others added 4 commits September 30, 2024 10:17
Add references to the ftintitle plugin for the bug fixes beetbox#5441 and beetbox#5436
that are related to this plugin.
Remove the optional `for_artist` keyword in the
`ftintitle.contains_feat` function and hardcode it to False, since it is
always used like this in the ftintitle plugin.
Since the `for_artist` keyword has been removed from
`ftintitle.contains_feat`, the unit tests need to be updated.
This includes the deletion of the test cases that test the
`for_artist=True` delimiters.
@klb2 klb2 requested a review from snejus September 30, 2024 15:30
test/plugins/test_ftintitle.py Outdated Show resolved Hide resolved
Remove redundant unit tests for the `ftintitle.cotains_feat` function
@klb2 klb2 requested a review from snejus October 1, 2024 20:57
Copy link
Member

@snejus snejus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for patience, all looks great!

@snejus snejus merged commit 03f1205 into beetbox:master Oct 1, 2024
9 of 10 checks passed
@klb2 klb2 deleted the fix_false_positive_ftintitle branch October 2, 2024 14:36
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 this pull request may close these issues.

ftintitle: False positives in "feat. X" detection
2 participants