From e8e8a2e934970f27ca47ff1b54c6b5f22f529272 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Wed, 18 Mar 2026 13:03:01 -0700 Subject: [PATCH] Fix deep scan skipping file path updates for existing tracks Deep scan passed skip_existing_tracks=True which skipped calling insert_or_update_media_track entirely for known tracks, so stale file paths were never refreshed from the media server. Now always calls insert_or_update (which safely uses UPDATE for existing tracks, preserving enrichment data) so file paths stay in sync. --- core/database_update_worker.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/database_update_worker.py b/core/database_update_worker.py index 5bb1aadc..9748bab6 100644 --- a/core/database_update_worker.py +++ b/core/database_update_worker.py @@ -1364,13 +1364,13 @@ class DatabaseUpdateWorker(QThread): if seen_track_ids is not None: seen_track_ids.add(track_id_str) - # Deep scan: skip tracks already in DB to preserve enrichment - if skip_existing_tracks and self.database.track_exists_by_server(track_id_str, self.server_type): - skipped_count += 1 - continue - + # Deep scan: always call insert_or_update to refresh file_path + # and other server-provided fields. UPDATE preserves enrichment. + is_existing = skip_existing_tracks and self.database.track_exists_by_server(track_id_str, self.server_type) track_success = self.database.insert_or_update_media_track(track, alb_id, art_id, server_source=self.server_type) - if track_success: + if is_existing: + skipped_count += 1 + elif track_success: track_count += 1 except Exception as e: logger.warning(f"Failed to process track '{getattr(track, 'title', 'Unknown')}': {e}") @@ -1382,7 +1382,7 @@ class DatabaseUpdateWorker(QThread): logger.warning(f"Failed to process album '{getattr(album, 'title', 'Unknown')}': {e}") if skip_existing_tracks: - details = f"{album_count} albums, {track_count} new tracks ({skipped_count} existing skipped)" + details = f"{album_count} albums, {track_count} new tracks ({skipped_count} existing updated)" else: details = f"Updated with {album_count} albums, {track_count} tracks" return True, details, album_count, track_count