fixed issue where legacy cold was called.
This commit is contained in:
parent
087ead1a9a
commit
9af0be1300
2 changed files with 12 additions and 12 deletions
|
|
@ -533,7 +533,7 @@ class DatabaseUpdateWorker(QThread):
|
||||||
total_tracks_checked += len(album_tracks)
|
total_tracks_checked += len(album_tracks)
|
||||||
|
|
||||||
for track in 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
|
album_has_new_tracks = True
|
||||||
consecutive_complete_albums = 0 # Reset counter
|
consecutive_complete_albums = 0 # Reset counter
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -1202,18 +1202,18 @@ class MusicDatabase:
|
||||||
|
|
||||||
genres_json = json.dumps(genres) if genres else None
|
genres_json = json.dumps(genres) if genres else None
|
||||||
|
|
||||||
# Check if album exists with this ID and server source
|
# Check if album exists with this ID (PRIMARY KEY check)
|
||||||
cursor.execute("SELECT id FROM albums WHERE id = ? AND server_source = ?", (album_id, server_source))
|
cursor.execute("SELECT id, server_source FROM albums WHERE id = ?", (album_id,))
|
||||||
exists = cursor.fetchone()
|
existing = cursor.fetchone()
|
||||||
|
|
||||||
if exists:
|
if existing:
|
||||||
# Update existing album
|
# Album exists - update it (update server_source if different)
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
UPDATE albums
|
UPDATE albums
|
||||||
SET artist_id = ?, title = ?, year = ?, thumb_url = ?, genres = ?,
|
SET artist_id = ?, title = ?, year = ?, thumb_url = ?, genres = ?,
|
||||||
track_count = ?, duration = ?, updated_at = CURRENT_TIMESTAMP
|
track_count = ?, duration = ?, server_source = ?, updated_at = CURRENT_TIMESTAMP
|
||||||
WHERE id = ? AND server_source = ?
|
WHERE id = ?
|
||||||
""", (artist_id, title, year, thumb_url, genres_json, track_count, duration, album_id, server_source))
|
""", (artist_id, title, year, thumb_url, genres_json, track_count, duration, server_source, album_id))
|
||||||
else:
|
else:
|
||||||
# Insert new album
|
# Insert new album
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue