Surface silent exceptions in workers + repair jobs — ~30 sites
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
This commit is contained in:
parent
8219771304
commit
e95452b465
18 changed files with 52 additions and 52 deletions
|
|
@ -140,8 +140,8 @@ class AudioDBWorker:
|
||||||
itype = item.get('type', '')
|
itype = item.get('type', '')
|
||||||
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
||||||
# Can't mark status without an ID — just skip
|
# Can't mark status without an ID — just skip
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("null id table resolve failed: %s", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,8 +141,8 @@ class DeezerWorker:
|
||||||
itype = item.get('type', '')
|
itype = item.get('type', '')
|
||||||
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
||||||
# Can't mark status without an ID — just skip
|
# Can't mark status without an ID — just skip
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("null id table resolve failed: %s", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -298,8 +298,8 @@ class DiscogsWorker:
|
||||||
self.stats['errors'] += 1
|
self.stats['errors'] += 1
|
||||||
try:
|
try:
|
||||||
self._mark_status(item['type'], item['id'], 'error')
|
self._mark_status(item['type'], item['id'], 'error')
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("mark item status error failed: %s", e)
|
||||||
|
|
||||||
def _get_existing_id(self, entity_type: str, entity_id) -> Optional[str]:
|
def _get_existing_id(self, entity_type: str, entity_id) -> Optional[str]:
|
||||||
"""Check if entity already has a discogs_id."""
|
"""Check if entity already has a discogs_id."""
|
||||||
|
|
|
||||||
|
|
@ -154,8 +154,8 @@ class GeniusWorker:
|
||||||
itype = item.get('type', '')
|
itype = item.get('type', '')
|
||||||
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
||||||
# Can't mark status without an ID — just skip
|
# Can't mark status without an ID — just skip
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("null-id item type lookup: %s", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._process_item(item)
|
self._process_item(item)
|
||||||
|
|
@ -367,8 +367,8 @@ class GeniusWorker:
|
||||||
if song_url:
|
if song_url:
|
||||||
try:
|
try:
|
||||||
lyrics = self.client.get_lyrics(song_url)
|
lyrics = self.client.get_lyrics(song_url)
|
||||||
except Exception:
|
except Exception as _e:
|
||||||
pass
|
logger.debug("genius lyrics scrape: %s", _e)
|
||||||
self._update_track(track_id, full_song, full_song, lyrics)
|
self._update_track(track_id, full_song, full_song, lyrics)
|
||||||
self.stats['matched'] += 1
|
self.stats['matched'] += 1
|
||||||
logger.info(f"Enriched track '{track_name}' from existing Genius ID: {existing_id}")
|
logger.info(f"Enriched track '{track_name}' from existing Genius ID: {existing_id}")
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,8 @@ class iTunesWorker:
|
||||||
itype = item.get('type', '')
|
itype = item.get('type', '')
|
||||||
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
||||||
# Can't mark status without an ID — just skip
|
# Can't mark status without an ID — just skip
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("null id table resolve failed: %s", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._process_item(item)
|
self._process_item(item)
|
||||||
|
|
|
||||||
|
|
@ -155,8 +155,8 @@ class LastFMWorker:
|
||||||
itype = item.get('type', '')
|
itype = item.get('type', '')
|
||||||
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
||||||
# Can't mark status without an ID — just skip
|
# Can't mark status without an ID — just skip
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("null id table resolve failed: %s", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._process_item(item)
|
self._process_item(item)
|
||||||
|
|
|
||||||
|
|
@ -141,8 +141,8 @@ class MusicBrainzWorker:
|
||||||
itype = item.get('type', '')
|
itype = item.get('type', '')
|
||||||
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
||||||
# Can't mark status without an ID — just skip
|
# Can't mark status without an ID — just skip
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("null id table resolve failed: %s", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ class QobuzWorker:
|
||||||
try:
|
try:
|
||||||
if self.client:
|
if self.client:
|
||||||
authenticated = self.client.is_authenticated()
|
authenticated = self.client.is_authenticated()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("qobuz auth status check: %s", e)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
|
|
@ -163,8 +163,8 @@ class QobuzWorker:
|
||||||
itype = item.get('type', '')
|
itype = item.get('type', '')
|
||||||
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
||||||
# Can't mark status without an ID — just skip
|
# Can't mark status without an ID — just skip
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("null-id item type lookup: %s", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ def _read_tag(audio, tag_name):
|
||||||
if vals:
|
if vals:
|
||||||
return vals[0].decode('utf-8') if isinstance(vals[0], bytes) else str(vals[0])
|
return vals[0].decode('utf-8') if isinstance(vals[0], bytes) else str(vals[0])
|
||||||
return None
|
return None
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("read tag value failed: %s", e)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -299,8 +299,8 @@ class DiscographyBackfillJob(RepairJob):
|
||||||
track_id = track_item.get('id', '')
|
track_id = track_item.get('id', '')
|
||||||
if track_id and self._is_in_wishlist(context.db, track_id):
|
if track_id and self._is_in_wishlist(context.db, track_id):
|
||||||
continue
|
continue
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("wishlist membership check failed: %s", e)
|
||||||
|
|
||||||
# Build wishlist-ready track data. album is a dict (required by
|
# Build wishlist-ready track data. album is a dict (required by
|
||||||
# add_to_wishlist and by the download pipeline's cover-art
|
# add_to_wishlist and by the download pipeline's cover-art
|
||||||
|
|
|
||||||
|
|
@ -337,8 +337,8 @@ class LibraryReorganizeJob(RepairJob):
|
||||||
if context.config_manager:
|
if context.config_manager:
|
||||||
try:
|
try:
|
||||||
active_server = context.config_manager.get_active_media_server()
|
active_server = context.config_manager.get_active_media_server()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("active media server lookup: %s", e)
|
||||||
try:
|
try:
|
||||||
conn = context.db._get_connection()
|
conn = context.db._get_connection()
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -366,8 +366,8 @@ class MbidMismatchDetectorJob(RepairJob):
|
||||||
try:
|
try:
|
||||||
from core.musicbrainz_client import MusicBrainzClient
|
from core.musicbrainz_client import MusicBrainzClient
|
||||||
mb_client = MusicBrainzClient()
|
mb_client = MusicBrainzClient()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("MusicBrainz client init failed: %s", e)
|
||||||
|
|
||||||
if not mb_client:
|
if not mb_client:
|
||||||
logger.warning("MusicBrainz client not available, skipping MBID mismatch scan")
|
logger.warning("MusicBrainz client not available, skipping MBID mismatch scan")
|
||||||
|
|
|
||||||
|
|
@ -159,8 +159,8 @@ class OrphanFileDetectorJob(RepairJob):
|
||||||
(first_artist and (clean_title, first_artist) in known_titles_clean)
|
(first_artist and (clean_title, first_artist) in known_titles_clean)
|
||||||
):
|
):
|
||||||
is_known = True
|
is_known = True
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("tag-based orphan check: %s", e)
|
||||||
|
|
||||||
# Last resort: parse title from filename pattern "NN - Title [Quality].ext"
|
# Last resort: parse title from filename pattern "NN - Title [Quality].ext"
|
||||||
# and match against known titles. Catches files with unreadable tags.
|
# 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:
|
if clean_fn and (clean_fn, clean_fa) in known_titles_clean:
|
||||||
is_known = True
|
is_known = True
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("filename-pattern orphan check: %s", e)
|
||||||
|
|
||||||
if not is_known:
|
if not is_known:
|
||||||
orphan_files.append(fpath)
|
orphan_files.append(fpath)
|
||||||
|
|
|
||||||
|
|
@ -496,8 +496,8 @@ class UnknownArtistFixerJob(RepairJob):
|
||||||
if not os.path.exists(sidecar_dst):
|
if not os.path.exists(sidecar_dst):
|
||||||
try:
|
try:
|
||||||
shutil.move(sidecar_src, sidecar_dst)
|
shutil.move(sidecar_src, sidecar_dst)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("move sidecar file: %s", e)
|
||||||
|
|
||||||
# Also move cover.jpg from old album folder
|
# Also move cover.jpg from old album folder
|
||||||
cover_src = os.path.join(src_dir, 'cover.jpg')
|
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):
|
if os.path.isfile(cover_src) and not os.path.exists(cover_dst):
|
||||||
try:
|
try:
|
||||||
shutil.copy2(cover_src, cover_dst)
|
shutil.copy2(cover_src, cover_dst)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("copy cover.jpg: %s", e)
|
||||||
|
|
||||||
# Clean up empty directories
|
# Clean up empty directories
|
||||||
parent = os.path.dirname(current_norm)
|
parent = os.path.dirname(current_norm)
|
||||||
|
|
|
||||||
|
|
@ -280,8 +280,8 @@ class SoulIDWorker:
|
||||||
if conn:
|
if conn:
|
||||||
try:
|
try:
|
||||||
conn.rollback()
|
conn.rollback()
|
||||||
except Exception:
|
except Exception as _e:
|
||||||
pass
|
logger.debug("rollback failed: %s", _e)
|
||||||
return 0
|
return 0
|
||||||
finally:
|
finally:
|
||||||
if conn:
|
if conn:
|
||||||
|
|
@ -533,8 +533,8 @@ class SoulIDWorker:
|
||||||
if conn:
|
if conn:
|
||||||
try:
|
try:
|
||||||
conn.rollback()
|
conn.rollback()
|
||||||
except Exception:
|
except Exception as _e:
|
||||||
pass
|
logger.debug("rollback failed: %s", _e)
|
||||||
return 0
|
return 0
|
||||||
finally:
|
finally:
|
||||||
if conn:
|
if conn:
|
||||||
|
|
@ -595,8 +595,8 @@ class SoulIDWorker:
|
||||||
if conn:
|
if conn:
|
||||||
try:
|
try:
|
||||||
conn.rollback()
|
conn.rollback()
|
||||||
except Exception:
|
except Exception as _e:
|
||||||
pass
|
logger.debug("rollback failed: %s", _e)
|
||||||
return 0
|
return 0
|
||||||
finally:
|
finally:
|
||||||
if conn:
|
if conn:
|
||||||
|
|
@ -634,8 +634,8 @@ class SoulIDWorker:
|
||||||
if conn:
|
if conn:
|
||||||
try:
|
try:
|
||||||
conn.rollback()
|
conn.rollback()
|
||||||
except Exception:
|
except Exception as _e:
|
||||||
pass
|
logger.debug("rollback failed: %s", _e)
|
||||||
finally:
|
finally:
|
||||||
if conn:
|
if conn:
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
|
||||||
|
|
@ -234,8 +234,8 @@ class SpotifyWorker:
|
||||||
itype = item.get('type', '')
|
itype = item.get('type', '')
|
||||||
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
||||||
# Can't mark status without an ID — just skip
|
# Can't mark status without an ID — just skip
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("null id table resolve failed: %s", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._process_item(item)
|
self._process_item(item)
|
||||||
|
|
|
||||||
|
|
@ -124,8 +124,8 @@ class TidalWorker:
|
||||||
authenticated = False
|
authenticated = False
|
||||||
try:
|
try:
|
||||||
authenticated = self.client.is_authenticated()
|
authenticated = self.client.is_authenticated()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("tidal auth status check: %s", e)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'enabled': True,
|
'enabled': True,
|
||||||
|
|
@ -176,8 +176,8 @@ class TidalWorker:
|
||||||
itype = item.get('type', '')
|
itype = item.get('type', '')
|
||||||
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
table = 'artists' if 'artist' in itype else ('albums' if 'album' in itype else 'tracks')
|
||||||
# Can't mark status without an ID — just skip
|
# Can't mark status without an ID — just skip
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("null-id item type lookup: %s", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,8 +209,8 @@ class WebMetadataUpdateWorker:
|
||||||
raw = self._db.api_get_artist(best.id)
|
raw = self._db.api_get_artist(best.id)
|
||||||
if raw:
|
if raw:
|
||||||
spotify_artist_id = raw.get('spotify_artist_id')
|
spotify_artist_id = raw.get('spotify_artist_id')
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logger.debug("get spotify_artist_id failed: %s", e)
|
||||||
return best, has_genres, spotify_artist_id
|
return best, has_genres, spotify_artist_id
|
||||||
except Exception:
|
except Exception:
|
||||||
return None, False, None
|
return None, False, None
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue