fix: stop matching instrumental tracks against unrelated songs (#40)#47
Merged
fix: stop matching instrumental tracks against unrelated songs (#40)#47
Conversation
Honor LRCLIB's instrumental flag, validate every match against the requested duration and artist, and drop the track-name-only fuzzy fallback when artist info is available. Adds a configurable duration-tolerance filter (default on, ±15s) with a UI toggle so users can disable or tune it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #40 — instrumental/interlude tracks being assigned lyrics from a completely different song that happens to share a similar title.
Three layered changes in
LyricsProvider.cs, plus a user-facing toggle:instrumental: trueflag. It was already being deserialized inLyricsSearchResponsebut never read.GetRemoteLyricsnow early-returns empty when the flag is set, so LRCLIB-known instrumentals stop producing matches.IsAcceptableMatchhelper rejects results whose artist doesn't appear (case-insensitive substring against any token fromSplitArtists) or whose duration differs from the local file by more than the configured tolerance. Applied in bothGetExactMatch(single response from/api/get) andSearchLrclib(per-item filter on/api/searchresults).SearchLrclib(trackName, null, null)— which is exactly how "Faded (Interlude)" by Alan Walker ended up matching a "Faded" by some other artist. The fallback is preserved only when no artist info is available at all.New setting
Existing users get the filter on by default after update — the bug is fixed out-of-the-box without any settings change.
Test plan
dotnet buildclean (0 warnings, 0 errors)Notes for reviewers
Rejected LRCLIB match {Id}: artist mismatch …/… duration mismatch …/Skipping LRCLIB entry … flagged as instrumental) make it easy to confirm the fix is working in the wild.