From e95452b4657799b4c2343c12a368d966b40dfdd7 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Thu, 7 May 2026 10:27:24 -0700 Subject: [PATCH] =?UTF-8?q?Surface=20silent=20exceptions=20in=20workers=20?= =?UTF-8?q?+=20repair=20jobs=20=E2=80=94=20~30=20sites?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Across all background workers (Spotify/Tidal/Deezer/Qobuz/iTunes/ Discogs/Genius/AudioDB/MusicBrainz/Last.fm/SoulID + the metadata-update worker) and the repair-job scanners. All converted to `logger.debug("...: %s", e)`. Two `_e` renames in genius_worker and soulid_worker where outer scope was already binding `e`. Two finally-block sites in repair_jobs/ library_reorganize.py left silent (conn.close on shutdown path). Refs #369 --- core/audiodb_worker.py | 4 ++-- core/deezer_worker.py | 4 ++-- core/discogs_worker.py | 4 ++-- core/genius_worker.py | 8 ++++---- core/itunes_worker.py | 4 ++-- core/lastfm_worker.py | 4 ++-- core/musicbrainz_worker.py | 4 ++-- core/qobuz_worker.py | 8 ++++---- core/repair_jobs/album_tag_consistency.py | 4 ++-- core/repair_jobs/discography_backfill.py | 4 ++-- core/repair_jobs/library_reorganize.py | 4 ++-- core/repair_jobs/mbid_mismatch_detector.py | 4 ++-- core/repair_jobs/orphan_file_detector.py | 8 ++++---- core/repair_jobs/unknown_artist_fixer.py | 8 ++++---- core/soulid_worker.py | 16 ++++++++-------- core/spotify_worker.py | 4 ++-- core/tidal_worker.py | 8 ++++---- core/workers/metadata_update.py | 4 ++-- 18 files changed, 52 insertions(+), 52 deletions(-) diff --git a/core/audiodb_worker.py b/core/audiodb_worker.py index cfb323bc..37c404d9 100644 --- a/core/audiodb_worker.py +++ b/core/audiodb_worker.py @@ -140,8 +140,8 @@ class AudioDBWorker: itype = item.get('type', '') table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks') # Can't mark status without an ID — just skip - except Exception: - pass + except Exception as e: + logger.debug("null id table resolve failed: %s", e) continue diff --git a/core/deezer_worker.py b/core/deezer_worker.py index bdaf2fb2..aba5c6fb 100644 --- a/core/deezer_worker.py +++ b/core/deezer_worker.py @@ -141,8 +141,8 @@ class DeezerWorker: itype = item.get('type', '') table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks') # Can't mark status without an ID — just skip - except Exception: - pass + except Exception as e: + logger.debug("null id table resolve failed: %s", e) continue diff --git a/core/discogs_worker.py b/core/discogs_worker.py index 84270de9..8663934f 100644 --- a/core/discogs_worker.py +++ b/core/discogs_worker.py @@ -298,8 +298,8 @@ class DiscogsWorker: self.stats['errors'] += 1 try: self._mark_status(item['type'], item['id'], 'error') - except Exception: - pass + except Exception as e: + logger.debug("mark item status error failed: %s", e) def _get_existing_id(self, entity_type: str, entity_id) -> Optional[str]: """Check if entity already has a discogs_id.""" diff --git a/core/genius_worker.py b/core/genius_worker.py index 63de47a6..e2e731fd 100644 --- a/core/genius_worker.py +++ b/core/genius_worker.py @@ -154,8 +154,8 @@ class GeniusWorker: itype = item.get('type', '') table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks') # Can't mark status without an ID — just skip - except Exception: - pass + except Exception as e: + logger.debug("null-id item type lookup: %s", e) continue self._process_item(item) @@ -367,8 +367,8 @@ class GeniusWorker: if song_url: try: lyrics = self.client.get_lyrics(song_url) - except Exception: - pass + except Exception as _e: + logger.debug("genius lyrics scrape: %s", _e) self._update_track(track_id, full_song, full_song, lyrics) self.stats['matched'] += 1 logger.info(f"Enriched track '{track_name}' from existing Genius ID: {existing_id}") diff --git a/core/itunes_worker.py b/core/itunes_worker.py index eebca734..50cf0df0 100644 --- a/core/itunes_worker.py +++ b/core/itunes_worker.py @@ -144,8 +144,8 @@ class iTunesWorker: itype = item.get('type', '') table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks') # Can't mark status without an ID — just skip - except Exception: - pass + except Exception as e: + logger.debug("null id table resolve failed: %s", e) continue self._process_item(item) diff --git a/core/lastfm_worker.py b/core/lastfm_worker.py index 2509f4aa..69a4c360 100644 --- a/core/lastfm_worker.py +++ b/core/lastfm_worker.py @@ -155,8 +155,8 @@ class LastFMWorker: itype = item.get('type', '') table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks') # Can't mark status without an ID — just skip - except Exception: - pass + except Exception as e: + logger.debug("null id table resolve failed: %s", e) continue self._process_item(item) diff --git a/core/musicbrainz_worker.py b/core/musicbrainz_worker.py index 08e02248..fe6461fc 100644 --- a/core/musicbrainz_worker.py +++ b/core/musicbrainz_worker.py @@ -141,8 +141,8 @@ class MusicBrainzWorker: itype = item.get('type', '') table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks') # Can't mark status without an ID — just skip - except Exception: - pass + except Exception as e: + logger.debug("null id table resolve failed: %s", e) continue diff --git a/core/qobuz_worker.py b/core/qobuz_worker.py index 31d26c78..c6ba2be7 100644 --- a/core/qobuz_worker.py +++ b/core/qobuz_worker.py @@ -104,8 +104,8 @@ class QobuzWorker: try: if self.client: authenticated = self.client.is_authenticated() - except Exception: - pass + except Exception as e: + logger.debug("qobuz auth status check: %s", e) return { 'enabled': True, @@ -163,8 +163,8 @@ class QobuzWorker: itype = item.get('type', '') table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks') # Can't mark status without an ID — just skip - except Exception: - pass + except Exception as e: + logger.debug("null-id item type lookup: %s", e) continue diff --git a/core/repair_jobs/album_tag_consistency.py b/core/repair_jobs/album_tag_consistency.py index 3a8abd14..1ae32254 100644 --- a/core/repair_jobs/album_tag_consistency.py +++ b/core/repair_jobs/album_tag_consistency.py @@ -62,8 +62,8 @@ def _read_tag(audio, tag_name): if vals: return vals[0].decode('utf-8') if isinstance(vals[0], bytes) else str(vals[0]) return None - except Exception: - pass + except Exception as e: + logger.debug("read tag value failed: %s", e) return None diff --git a/core/repair_jobs/discography_backfill.py b/core/repair_jobs/discography_backfill.py index 2887a711..9b7890ca 100644 --- a/core/repair_jobs/discography_backfill.py +++ b/core/repair_jobs/discography_backfill.py @@ -299,8 +299,8 @@ class DiscographyBackfillJob(RepairJob): track_id = track_item.get('id', '') if track_id and self._is_in_wishlist(context.db, track_id): continue - except Exception: - pass + except Exception as e: + logger.debug("wishlist membership check failed: %s", e) # Build wishlist-ready track data. album is a dict (required by # add_to_wishlist and by the download pipeline's cover-art diff --git a/core/repair_jobs/library_reorganize.py b/core/repair_jobs/library_reorganize.py index e984c97e..0f9af632 100644 --- a/core/repair_jobs/library_reorganize.py +++ b/core/repair_jobs/library_reorganize.py @@ -337,8 +337,8 @@ class LibraryReorganizeJob(RepairJob): if context.config_manager: try: active_server = context.config_manager.get_active_media_server() - except Exception: - pass + except Exception as e: + logger.debug("active media server lookup: %s", e) try: conn = context.db._get_connection() try: diff --git a/core/repair_jobs/mbid_mismatch_detector.py b/core/repair_jobs/mbid_mismatch_detector.py index ef6ad77c..e35e9683 100644 --- a/core/repair_jobs/mbid_mismatch_detector.py +++ b/core/repair_jobs/mbid_mismatch_detector.py @@ -366,8 +366,8 @@ class MbidMismatchDetectorJob(RepairJob): try: from core.musicbrainz_client import MusicBrainzClient mb_client = MusicBrainzClient() - except Exception: - pass + except Exception as e: + logger.debug("MusicBrainz client init failed: %s", e) if not mb_client: logger.warning("MusicBrainz client not available, skipping MBID mismatch scan") diff --git a/core/repair_jobs/orphan_file_detector.py b/core/repair_jobs/orphan_file_detector.py index 48717f91..80c5a237 100644 --- a/core/repair_jobs/orphan_file_detector.py +++ b/core/repair_jobs/orphan_file_detector.py @@ -159,8 +159,8 @@ class OrphanFileDetectorJob(RepairJob): (first_artist and (clean_title, first_artist) in known_titles_clean) ): is_known = True - except Exception: - pass + except Exception as e: + logger.debug("tag-based orphan check: %s", e) # Last resort: parse title from filename pattern "NN - Title [Quality].ext" # and match against known titles. Catches files with unreadable tags. @@ -186,8 +186,8 @@ class OrphanFileDetectorJob(RepairJob): if clean_fn and (clean_fn, clean_fa) in known_titles_clean: is_known = True break - except Exception: - pass + except Exception as e: + logger.debug("filename-pattern orphan check: %s", e) if not is_known: orphan_files.append(fpath) diff --git a/core/repair_jobs/unknown_artist_fixer.py b/core/repair_jobs/unknown_artist_fixer.py index 53216ed0..bf037748 100644 --- a/core/repair_jobs/unknown_artist_fixer.py +++ b/core/repair_jobs/unknown_artist_fixer.py @@ -496,8 +496,8 @@ class UnknownArtistFixerJob(RepairJob): if not os.path.exists(sidecar_dst): try: shutil.move(sidecar_src, sidecar_dst) - except Exception: - pass + except Exception as e: + logger.debug("move sidecar file: %s", e) # Also move cover.jpg from old album folder cover_src = os.path.join(src_dir, 'cover.jpg') @@ -505,8 +505,8 @@ class UnknownArtistFixerJob(RepairJob): if os.path.isfile(cover_src) and not os.path.exists(cover_dst): try: shutil.copy2(cover_src, cover_dst) - except Exception: - pass + except Exception as e: + logger.debug("copy cover.jpg: %s", e) # Clean up empty directories parent = os.path.dirname(current_norm) diff --git a/core/soulid_worker.py b/core/soulid_worker.py index 5dc011bb..aef60f6d 100644 --- a/core/soulid_worker.py +++ b/core/soulid_worker.py @@ -280,8 +280,8 @@ class SoulIDWorker: if conn: try: conn.rollback() - except Exception: - pass + except Exception as _e: + logger.debug("rollback failed: %s", _e) return 0 finally: if conn: @@ -533,8 +533,8 @@ class SoulIDWorker: if conn: try: conn.rollback() - except Exception: - pass + except Exception as _e: + logger.debug("rollback failed: %s", _e) return 0 finally: if conn: @@ -595,8 +595,8 @@ class SoulIDWorker: if conn: try: conn.rollback() - except Exception: - pass + except Exception as _e: + logger.debug("rollback failed: %s", _e) return 0 finally: if conn: @@ -634,8 +634,8 @@ class SoulIDWorker: if conn: try: conn.rollback() - except Exception: - pass + except Exception as _e: + logger.debug("rollback failed: %s", _e) finally: if conn: conn.close() diff --git a/core/spotify_worker.py b/core/spotify_worker.py index 3fa503c4..9349bb74 100644 --- a/core/spotify_worker.py +++ b/core/spotify_worker.py @@ -234,8 +234,8 @@ class SpotifyWorker: itype = item.get('type', '') table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks') # Can't mark status without an ID — just skip - except Exception: - pass + except Exception as e: + logger.debug("null id table resolve failed: %s", e) continue self._process_item(item) diff --git a/core/tidal_worker.py b/core/tidal_worker.py index a9f7d41c..4bcb434a 100644 --- a/core/tidal_worker.py +++ b/core/tidal_worker.py @@ -124,8 +124,8 @@ class TidalWorker: authenticated = False try: authenticated = self.client.is_authenticated() - except Exception: - pass + except Exception as e: + logger.debug("tidal auth status check: %s", e) return { 'enabled': True, @@ -176,8 +176,8 @@ class TidalWorker: itype = item.get('type', '') table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks') # Can't mark status without an ID — just skip - except Exception: - pass + except Exception as e: + logger.debug("null-id item type lookup: %s", e) continue diff --git a/core/workers/metadata_update.py b/core/workers/metadata_update.py index 085015f1..abc146fa 100644 --- a/core/workers/metadata_update.py +++ b/core/workers/metadata_update.py @@ -209,8 +209,8 @@ class WebMetadataUpdateWorker: raw = self._db.api_get_artist(best.id) if raw: spotify_artist_id = raw.get('spotify_artist_id') - except Exception: - pass + except Exception as e: + logger.debug("get spotify_artist_id failed: %s", e) return best, has_genres, spotify_artist_id except Exception: return None, False, None