MS pre-review polish followup — log levels + docstring honesty

Three nits I missed in the prior pass:

(1) Two more exception swallows still at logger.debug — the
get_recently_added_albums wrapper and the configured_clients
inner loop. My earlier sed only matched single-line patterns.
Both now log at warning level so a broken Plex / Jellyfin
surfaces in the boot log instead of silently returning [].

(2) registry.py module docstring still claimed it replaced
"33 hand-maintained dispatch sites" — same overclaim I fixed
on the engine docstring. Server-specific chains stay explicit
in web_server.py per the "lift what's truly shared" standard;
the registry just owns name → client lookup. Docstring rewritten
to match reality.
This commit is contained in:
Broque Thomas 2026-05-05 21:25:27 -07:00
parent 860f9a0a8c
commit 99f527ecd1
2 changed files with 12 additions and 6 deletions

View file

@ -233,7 +233,7 @@ class MediaServerEngine:
try: try:
return client.get_recently_added_albums(max_results) return client.get_recently_added_albums(max_results)
except Exception as exc: except Exception as exc:
logger.debug( logger.warning(
"%s get_recently_added_albums raised: %s", "%s get_recently_added_albums raised: %s",
self.active_server, exc, self.active_server, exc,
) )
@ -256,7 +256,7 @@ class MediaServerEngine:
if not hasattr(client, 'is_connected') or client.is_connected(): if not hasattr(client, 'is_connected') or client.is_connected():
result[name] = client result[name] = client
except Exception as exc: except Exception as exc:
logger.debug("%s is_connected raised in configured_clients: %s", name, exc) logger.warning("%s is_connected raised in configured_clients: %s", name, exc)
return result return result
def reload_config(self, name: Optional[str] = None) -> bool: def reload_config(self, name: Optional[str] = None) -> bool:

View file

@ -3,11 +3,17 @@
Single source of truth for which servers exist, what their canonical Single source of truth for which servers exist, what their canonical
names are, and which client class implements each. Replaces the names are, and which client class implements each. Replaces the
historic web_server.py pattern of holding 4 separate client globals historic web_server.py pattern of holding 4 separate client globals
+ 33 hand-maintained ``if active_server == 'plex' / 'jellyfin' / ...`` that every dispatch site reached individually.
dispatch sites.
Adding a new server (e.g. Subsonic, Emby) becomes one ``register`` Server-specific dispatch chains in web_server.py (playlist add /
call here + the new client class. Web server dispatch stays put. remove / replace, per-server metadata sync, etc.) still hand-branch
on ``active_server == X`` because the work each server does at those
sites is genuinely different but they reach the per-server CLIENT
through ``engine.client(name)`` (which goes through this registry)
instead of separate globals.
Adding a new server (Subsonic / Emby) = one ``register`` call here +
the new client class.
""" """
from __future__ import annotations from __future__ import annotations