summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/tmdb.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-24 15:57:41 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-24 15:57:41 +0200
commitc5585beab3d6adefaa2ef9444946dd3816960a7c (patch)
treea321e540c2db0458716d526e4a045fca123937b2 /packages/meshbay-node/src/meshbay_node/tmdb.py
parent317f09328ed8bf20148b707470c9b0fe82e59575 (diff)
downloadmeshbay-c5585beab3d6adefaa2ef9444946dd3816960a7c.tar.gz
fix(node,hub): HEVC transcode fallback, live-add progress, per-group TMDB toggle
Three bugs found live testing the Videos app against a real HEVC/EAC3 show, plus a design change requested afterward: - Streaming always did "-c:v copy", which faithfully reports a source's real hev1 codec string but is unplayable in a browser with no HEVC decoder (most Chrome/Linux builds). The node now transcodes to H264 whenever the probed codec is browser-incompatible (media_probe.py's new BROWSER_INCOMPATIBLE_VIDEO_CODECS), with a `transcode_incompatible_video` node.toml opt-out for operators who know their viewers already decode it. - Dropping a whole season into an already-watched folder gave no scanning indicator and no progress bar: IndexProgress was only ever updated by the two bulk scan paths, never by the real-time per-file watchdog path (_schedule_update/_debounce/_update_entry). That path now accounts a "burst" the same way, without double-counting a file rewritten mid-debounce. - A stray literal "0" rendered in the video detail modal when there was no TMDB match (`meta.confidence` is 0, and `0 && x` renders "0" in JSX/htm, not nothing) — `confident` is now a real boolean. - Whether TMDB is used at all moves from a node-wide setting to per-group (OP_TMDB_ENABLED/tmdb_enabled/tmdb_enabled_ack, scoped like OP_VIDEO_ROOT): an operator running a real media-library group alongside test/demo groups on one node wants outbound TMDB traffic for the one that needs it, not all of them. The custom API token and query language stay node-wide, one shared credential/cache (tmdb_config/OP_TMDB_CONFIG, unchanged reasoning). MNP_VERSION 0.6 -> 0.7, additive. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LAmyXtc6dAADsH23ydXQpY
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/tmdb.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/tmdb.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/tmdb.py b/packages/meshbay-node/src/meshbay_node/tmdb.py
index 448a2b9..a530660 100644
--- a/packages/meshbay-node/src/meshbay_node/tmdb.py
+++ b/packages/meshbay-node/src/meshbay_node/tmdb.py
@@ -20,6 +20,12 @@ Results also come back in whatever language the operator configured
node, same reasoning as the token: one shared cache, not a per-viewer
request. Omitted entirely when unset, which lets TMDB fall back to its own
default (English) rather than this client guessing one.
+
+Whether TMDB is used *at all* is a **per-group** decision (roster.py's
+`tmdb_enabled(group_id)`, moved off the node-wide sentinel 2026-08-24) —
+this client has no group in scope, so that check happens once, in
+webrtc_server.py, before any of this client's methods are ever called for a
+given request. This client only resolves the shared credential/language.
"""
import difflib
@@ -80,17 +86,24 @@ class TmdbClient:
await self._client.aclose()
async def _resolve(self) -> tuple[bool, str | None, str | None]:
- """Returns (enabled, token, language). token/language are None when unset."""
+ """
+ Returns (has_token, token, language). token/language are None when
+ unset. Whether TMDB is used *at all* is a per-group decision made by
+ the caller (roster.tmdb_enabled(group_id), checked in
+ webrtc_server.py before any of this client's methods are called) —
+ this client only knows the node-wide credential/language, and has no
+ group to check against.
+ """
if self._roster is not None:
- enabled, custom_token, language = await self._roster.tmdb_config()
+ custom_token, language = await self._roster.tmdb_config()
else:
- enabled, custom_token, language = True, None, None
+ custom_token, language = None, None
token = custom_token or os.environ.get(_DEFAULT_TOKEN_ENV) or None
- return enabled and bool(token), token, language
+ return bool(token), token, language
async def _get(self, path: str, params: dict) -> dict | None:
- enabled, token, language = await self._resolve()
- if not enabled:
+ has_token, token, language = await self._resolve()
+ if not has_token:
return None
if language and "language" not in params:
params = {**params, "language": language}