From 9af0be1300005771607a41a98da9e30bfe78f17b Mon Sep 17 00:00:00 2001 From: Broque Thomas Date: Mon, 26 Jan 2026 13:37:42 -0800 Subject: [PATCH] fixed issue where legacy cold was called. --- core/database_update_worker.py | 2 +- database/music_database.py | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/database_update_worker.py b/core/database_update_worker.py index 7af4bb0b..ebfb81ae 100644 --- a/core/database_update_worker.py +++ b/core/database_update_worker.py @@ -533,7 +533,7 @@ class DatabaseUpdateWorker(QThread): total_tracks_checked += len(album_tracks) for track in album_tracks: - if not self.database.track_exists(track.ratingKey, self.server_type): + if not self.database.track_exists_by_server(track.ratingKey, self.server_type): album_has_new_tracks = True consecutive_complete_albums = 0 # Reset counter break diff --git a/database/music_database.py b/database/music_database.py index bf28fc7a..605d0a30 100644 --- a/database/music_database.py +++ b/database/music_database.py @@ -1202,18 +1202,18 @@ class MusicDatabase: genres_json = json.dumps(genres) if genres else None - # Check if album exists with this ID and server source - cursor.execute("SELECT id FROM albums WHERE id = ? AND server_source = ?", (album_id, server_source)) - exists = cursor.fetchone() - - if exists: - # Update existing album + # Check if album exists with this ID (PRIMARY KEY check) + cursor.execute("SELECT id, server_source FROM albums WHERE id = ?", (album_id,)) + existing = cursor.fetchone() + + if existing: + # Album exists - update it (update server_source if different) cursor.execute(""" - UPDATE albums - SET artist_id = ?, title = ?, year = ?, thumb_url = ?, genres = ?, - track_count = ?, duration = ?, updated_at = CURRENT_TIMESTAMP - WHERE id = ? AND server_source = ? - """, (artist_id, title, year, thumb_url, genres_json, track_count, duration, album_id, server_source)) + UPDATE albums + SET artist_id = ?, title = ?, year = ?, thumb_url = ?, genres = ?, + track_count = ?, duration = ?, server_source = ?, updated_at = CURRENT_TIMESTAMP + WHERE id = ? + """, (artist_id, title, year, thumb_url, genres_json, track_count, duration, server_source, album_id)) else: # Insert new album cursor.execute("""