Surface silent exceptions in import pipeline — 11 sites

- imports/side_effects.py: 8 sites (post-import cleanup paths,
  thumbnail+lyrics pulls, Plex refresh)
- auto_import_worker.py: 3 sites (queue/dedup helpers)

All converted to `logger.debug("...: %s", e)`.

Refs #369
This commit is contained in:
Broque Thomas 2026-05-07 09:50:15 -07:00
parent aa9429d733
commit de348981a5
2 changed files with 22 additions and 22 deletions

View file

@ -596,8 +596,8 @@ class AutoImportWorker:
# Keep weak AcoustID result as fallback
if fp_result2 and (not result or fp_result2.get('identification_confidence', 0) > result.get('identification_confidence', 0)):
result = fp_result2
except Exception:
pass
except Exception as e:
logger.debug("acoustid fingerprint fallback failed: %s", e)
# If we have good tag data (artist + title), prefer tag-based identification
# over a weak metadata/AcoustID result — tags from post-processed files are reliable
@ -1100,8 +1100,8 @@ class AutoImportWorker:
if folder_artist and folder_artist.lower() != artist_name.lower():
logger.info(f"[Auto-Import] Parent folder artist '{folder_artist}' differs from tag artist '{artist_name}' — using folder artist")
artist_name = folder_artist
except Exception:
pass
except Exception as e:
logger.debug("folder artist override failed: %s", e)
release_date = identification.get('release_date', '') or album_data.get('release_date', '')
# Compute total discs
@ -1202,8 +1202,8 @@ class AutoImportWorker:
'completed_tracks': str(processed),
'failed_tracks': str(len(errors)),
})
except Exception:
pass
except Exception as e:
logger.debug("automation emit failed: %s", e)
return processed > 0

View file

@ -72,8 +72,8 @@ def emit_track_downloaded(context: Dict[str, Any], automation_engine=None) -> No
"quality": context.get("_audio_quality", "Unknown"),
},
)
except Exception:
pass
except Exception as e:
logger.debug("track_downloaded emit failed: %s", e)
def record_library_history_download(context: Dict[str, Any]) -> None:
@ -143,8 +143,8 @@ def record_library_history_download(context: Dict[str, Any]) -> None:
acoustid_result=acoustid_result,
source_artist=source_artist,
)
except Exception:
pass
except Exception as e:
logger.debug("library history record failed: %s", e)
def record_download_provenance(context: Dict[str, Any]) -> None:
@ -188,8 +188,8 @@ def record_download_provenance(context: Dict[str, Any]) -> None:
sample_rate = getattr(audio.info, "sample_rate", None)
bitrate = getattr(audio.info, "bitrate", None)
bit_depth = getattr(audio.info, "bits_per_sample", None)
except Exception:
pass
except Exception as e:
logger.debug("audio info probe failed: %s", e)
# Pull the metadata-source IDs out of context. ``embed_source_ids``
# in core/metadata/source.py wrote them to ``_embedded_id_tags``
@ -239,8 +239,8 @@ def record_download_provenance(context: Dict[str, Any]) -> None:
soul_id=soul_id,
isrc=isrc,
)
except Exception:
pass
except Exception as e:
logger.debug("record_download_provenance failed: %s", e)
def record_soulsync_library_entry(context: Dict[str, Any], artist_context: Dict[str, Any], album_info: Dict[str, Any]) -> None:
@ -321,8 +321,8 @@ def record_soulsync_library_entry(context: Dict[str, Any], artist_context: Dict[
audio = MutagenFile(final_path)
if audio and hasattr(audio, "info") and audio.info and hasattr(audio.info, "bitrate"):
bitrate = int(audio.info.bitrate / 1000) if audio.info.bitrate else 0
except Exception:
pass
except Exception as e:
logger.debug("bitrate read failed: %s", e)
# File size on disk (powers Library Disk Usage card on Stats).
# SoulSync standalone is the only path where the file is local
@ -371,8 +371,8 @@ def record_soulsync_library_entry(context: Dict[str, Any], artist_context: Dict[
f"UPDATE artists SET {artist_source_col} = ? WHERE id = ?",
(artist_source_id, artist_id),
)
except Exception:
pass
except Exception as e:
logger.debug("artist source-id update failed: %s", e)
cursor.execute("SELECT id FROM albums WHERE id = ? AND server_source = 'soulsync'", (album_id,))
if not cursor.fetchone():
@ -402,8 +402,8 @@ def record_soulsync_library_entry(context: Dict[str, Any], artist_context: Dict[
f"UPDATE albums SET {album_source_col} = ? WHERE id = ?",
(album_source_id, album_id),
)
except Exception:
pass
except Exception as e:
logger.debug("album source-id update failed: %s", e)
track_artist = None
track_artists_list = track_info.get("artists", []) or original_search.get("artists", [])
@ -451,8 +451,8 @@ def record_soulsync_library_entry(context: Dict[str, Any], artist_context: Dict[
f"UPDATE tracks SET {track_album_col} = ? WHERE id = ?",
(album_source_id, track_id),
)
except Exception:
pass
except Exception as e:
logger.debug("track source-id update failed: %s", e)
conn.commit()
logger.info("[SoulSync Library] Added: %s / %s / %s", artist_name, album_name, track_name)