summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_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/tests/test_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/tests/test_tmdb.py')
-rw-r--r--packages/meshbay-node/tests/test_tmdb.py27
1 files changed, 3 insertions, 24 deletions
diff --git a/packages/meshbay-node/tests/test_tmdb.py b/packages/meshbay-node/tests/test_tmdb.py
index 4500feb..fcbc2a2 100644
--- a/packages/meshbay-node/tests/test_tmdb.py
+++ b/packages/meshbay-node/tests/test_tmdb.py
@@ -7,14 +7,12 @@ from meshbay_node.tmdb import TmdbClient
class FakeRoster:
- def __init__(self, enabled: bool = True, token: str | None = "fake-token",
- language: str | None = None):
- self._enabled = enabled
+ def __init__(self, token: str | None = "fake-token", language: str | None = None):
self._token = token
self._language = language
async def tmdb_config(self):
- return self._enabled, self._token, self._language
+ return self._token, self._language
def _handler(response_map):
@@ -106,25 +104,6 @@ async def test_no_results_returns_none_and_zero_confidence():
@pytest.mark.asyncio
-async def test_disabled_via_roster_setting_makes_no_request():
- calls = []
-
- def handle(request: httpx.Request) -> httpx.Response:
- calls.append(request)
- return httpx.Response(200, json={"results": []})
-
- client = TmdbClient(
- roster=FakeRoster(enabled=False),
- transport=httpx.MockTransport(handle),
- )
- result, ratio = await client.search_movie("Anything")
-
- assert result is None
- assert calls == [] # confirms the disabled check short-circuits before any request
- await client.close()
-
-
-@pytest.mark.asyncio
async def test_no_token_resolvable_makes_no_request(monkeypatch):
monkeypatch.delenv("MESHBAY_TMDB_DEFAULT_TOKEN", raising=False)
calls = []
@@ -134,7 +113,7 @@ async def test_no_token_resolvable_makes_no_request(monkeypatch):
return httpx.Response(200, json={"results": []})
client = TmdbClient(
- roster=FakeRoster(enabled=True, token=None),
+ roster=FakeRoster(token=None),
transport=httpx.MockTransport(handle),
)
result, ratio = await client.search_movie("Anything")