fixed false positive issue from fallback query

removing artist from the search introduced false positives when searching plex.
This commit is contained in:
Broque Thomas 2025-07-29 10:35:57 -07:00
parent 6d8185e081
commit 2b97e685dc
5 changed files with 2155 additions and 12 deletions

View file

@ -373,10 +373,9 @@ class PlexClient:
logger.warning(f"Index mismatch: cannot store original track for '{track_info.title}'")
return tracks
# --- Stage 3: Title-Only Fallback Search ---
logger.debug(f"Stage 3: Performing title-only search for '{title}'")
stage3_results = self.music_library.searchTracks(title=title, limit=limit)
add_candidates(stage3_results)
# --- Stage 3: Title-Only Fallback REMOVED ---
# Removed to prevent false positives where tracks with same title
# but different artists are incorrectly matched
tracks = [PlexTrackInfo.from_plex_track(track) for track in candidate_tracks[:limit]]

File diff suppressed because it is too large Load diff

View file

@ -240,14 +240,8 @@ class PlaylistTrackAnalysisWorker(QRunnable):
return match_result.plex_track, match_result.confidence
# --- Final Fallback: Title-only search if no artist-based match was found ---
if not all_potential_matches:
print(f"🎤 No artist-based matches found. Performing final title-only fallback for '{original_title}'")
for query_title in unique_title_variations:
title_only_matches = self.plex_client.search_tracks(title=query_title, artist="", limit=10)
for track in title_only_matches:
if track.id not in found_match_ids:
all_potential_matches.append(track)
found_match_ids.add(track.id)
# Removed title-only fallback to prevent false positives
# A track by a different artist is NOT the same track
if not all_potential_matches:
print(f"❌ No Plex candidates found for '{original_title}' after all strategies.")