diff --git a/core/__pycache__/database_update_worker.cpython-312.pyc b/core/__pycache__/database_update_worker.cpython-312.pyc index fea64fd6..58e50de3 100644 Binary files a/core/__pycache__/database_update_worker.cpython-312.pyc and b/core/__pycache__/database_update_worker.cpython-312.pyc differ diff --git a/core/database_update_worker.py b/core/database_update_worker.py index d0012ab0..cba9428b 100644 --- a/core/database_update_worker.py +++ b/core/database_update_worker.py @@ -122,6 +122,25 @@ class DatabaseUpdateWorker(QThread): logger.error("No music library found in Plex") return [] + # Check if database has enough content for incremental updates + try: + stats = self.database.get_database_info() + track_count = stats.get('tracks', 0) + + if track_count < 100: # Minimum threshold for meaningful incremental updates + logger.warning(f"Database has only {track_count} tracks - insufficient for incremental updates") + logger.info("Switching to full refresh mode (incremental updates require established database)") + # Switch to full refresh automatically + self.full_refresh = True + return self._get_all_artists() + + logger.info(f"Database has {track_count} tracks - proceeding with incremental update") + + except Exception as e: + logger.warning(f"Could not check database state: {e} - defaulting to full refresh") + self.full_refresh = True + return self._get_all_artists() + # Strategy: Get recently added albums and extract artists from them # Process artists in reverse chronological order until we hit one that's already current diff --git a/database/music_library.db-shm b/database/music_library.db-shm deleted file mode 100644 index 1a99b1a2..00000000 Binary files a/database/music_library.db-shm and /dev/null differ diff --git a/database/music_library.db-wal b/database/music_library.db-wal deleted file mode 100644 index b98a2f84..00000000 Binary files a/database/music_library.db-wal and /dev/null differ