From e65f73abe2e16be3a3802906c533152adb960f85 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sun, 12 Apr 2026 15:41:55 -0700 Subject: [PATCH] Fix allow_duplicates setting not working in watchlist scanner The setting only affected wishlist dedup but the watchlist scanner's library check still skipped tracks by title+artist regardless. Now when allow_duplicates is enabled, the scanner compares album names and only skips if the same album matches. Same song on a different album is allowed through to the wishlist. --- core/watchlist_scanner.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/watchlist_scanner.py b/core/watchlist_scanner.py index 98c66c9d..312e9320 100644 --- a/core/watchlist_scanner.py +++ b/core/watchlist_scanner.py @@ -1524,15 +1524,22 @@ class WatchlistScanner: unique_title_variations = list(dict.fromkeys(title_variations)) # Search for each artist with each title variation - + from config.settings import config_manager + active_server = config_manager.get_active_media_server() + allow_duplicates = config_manager.get('wishlist.allow_duplicate_tracks', True) + for artist_name in artists_to_search: for query_title in unique_title_variations: - # Use same database check as modals with server awareness - from config.settings import config_manager - active_server = config_manager.get_active_media_server() db_track, confidence = self.database.check_track_exists(query_title, artist_name, confidence_threshold=0.7, server_source=active_server, album=album_name) - + if db_track and confidence >= 0.7: + # When allow_duplicates is on, only skip if the same album matches + if allow_duplicates and album_name and db_track.album_title: + from difflib import SequenceMatcher + album_sim = SequenceMatcher(None, album_name.lower(), db_track.album_title.lower()).ratio() + if album_sim < 0.8: + logger.debug(f"Track found but different album (allow_duplicates=True): '{original_title}' — library: '{db_track.album_title}', wanted: '{album_name}'") + continue # Different album — allow it logger.debug(f"Track found in library: '{original_title}' by '{artist_name}' (confidence: {confidence:.2f})") return False # Track exists in library