chore(release): promote 6.0.0 to main

This commit is contained in:
imSp4rky
2026-11-23 18:11:04 -07:00
425 changed files with 52275 additions and 12006 deletions
+3 -3
View File
@@ -10,7 +10,7 @@ from pathlib import Path
import pytest
def _load_scenarios(config: pytest.Config) -> dict:
def load_scenarios(config: pytest.Config) -> dict:
cached = getattr(config, "_e2e_scenarios_cache", None)
if cached is not None:
return cached
@@ -18,7 +18,7 @@ def _load_scenarios(config: pytest.Config) -> dict:
import yaml
path = Path(__file__).parent / "fixtures" / "fixtures.yaml"
data = yaml.safe_load(path.read_text()) if path.exists() else {}
data = yaml.safe_load(path.read_text(encoding="utf-8")) if path.exists() else {}
selected = (config.getoption("--services") or "").strip()
services = (data or {}).get("services", {}) or {}
if selected:
@@ -31,7 +31,7 @@ def _load_scenarios(config: pytest.Config) -> dict:
def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
if "service_case" in metafunc.fixturenames:
scenarios = _load_scenarios(metafunc.config)
scenarios = load_scenarios(metafunc.config)
params = [pytest.param((tag, conf), id=tag) for tag, conf in (scenarios.get("services") or {}).items()]
if not params:
params = [
+15 -15
View File
@@ -8,39 +8,39 @@
# unshackle (matches the service directory name, e.g. EXAMPLE). The keys
# below are read by the e2e tests:
#
# title_url (required) — movie URL/slug/ID accepted by the service
# series_url (optional) — series URL/slug/ID; when set, the
# title_url (required): movie URL/slug/ID accepted by the service
# series_url (optional): series URL/slug/ID; when set, the
# quality + license + download tests
# target target_season/target_episode
# instead of the movie
# target_season (optional, default 1)
# target_episode (optional, default 1)
# search_query (optional) — string to send to /api/search
# requires_auth (optional, default true) — informational
# server_cdm (optional, default false) — informational
# drm (optional) — informational ("widevine" / "playready")
# search_query (optional): string to send to /api/search
# requires_auth (optional, default true): informational
# server_cdm (optional, default false): informational
# drm (optional): informational ("widevine" / "playready")
#
# expected_quality (optional) — when present, the quality test
# expected_quality (optional): when present, the quality test
# asserts these limits against the
# discovered video tracks
# min_height (optional) — max video.height >= this
# min_codecs (optional) — codec names that must be present
# min_height (optional): max video.height >= this
# min_codecs (optional): codec names that must be present
# (AVC, HEVC, VC1, VP8, VP9, AV1)
# min_ranges (optional) — range names that must be present
# min_ranges (optional): range names that must be present
# (SDR, HDR10, HDR10P, DV, HLG, HYBRID)
# min_track_count (optional) — at least this many video tracks
# min_track_count (optional): at least this many video tracks
#
# runs_download_test (optional, default false) — when true, the
# runs_download_test (optional, default false): when true, the
# download smoke test
# runs for this service
# runs_license_test (optional, default false) — when true, the
# runs_license_test (optional, default false): when true, the
# license test runs for
# this service
# license_drm (optional, default "widevine") — DRM type the
# license_drm (optional, default "widevine"): DRM type the
# license test
# requests ("widevine"
# or "playready")
# license_quality (optional, default 1080) — pixel height of the
# license_quality (optional, default 1080): pixel height of the
# track the license test
# targets
+7 -7
View File
@@ -7,7 +7,7 @@ For any fixture service with ``runs_download_test: true``, this test:
4. Fetches the manifest URL with the resolved headers.
5. Asserts the body is non-empty and looks like DASH/HLS.
It does NOT decrypt or mux — that requires a full local CDM. It proves
It does NOT decrypt or mux; that requires a full local CDM. It proves
the end-to-end pipeline up to CDN reachability for the selected quality.
"""
@@ -20,7 +20,7 @@ import pytest
pytestmark = [pytest.mark.live, pytest.mark.slow]
def _wait_titles(http_session, server_url: str, sid: str, timeout: float = 120.0):
def wait_titles(http_session, server_url: str, sid: str, timeout: float = 120.0):
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
r = http_session.get(f"{server_url}/api/session/{sid}/titles", timeout=30)
@@ -38,14 +38,14 @@ def _wait_titles(http_session, server_url: str, sid: str, timeout: float = 120.0
return None
def _pick_target_title(titles, season: int = 1, episode: int = 1):
def pick_target_title(titles, season: int = 1, episode: int = 1):
for t in titles:
if t.get("type") == "episode" and t.get("season") == season and t.get("number") == episode:
return t
return titles[0] if titles else None
def _pick_track_at_height(video_tracks, target_height: int):
def pick_track_at_height(video_tracks, target_height: int):
same_height = [v for v in video_tracks if v.get("height") == target_height and v.get("range") == "SDR"]
return sorted(same_height, key=lambda v: v.get("bitrate") or 0)[0] if same_height else None
@@ -77,10 +77,10 @@ def test_download_manifest_fetch(http_session, server_url: str, service_case) ->
sid = r.json()["session_id"]
try:
body = _wait_titles(http_session, server_url, sid)
body = wait_titles(http_session, server_url, sid)
if not body:
pytest.skip(f"{service}: titles timeout")
target = _pick_target_title(
target = pick_target_title(
body.get("titles") or [],
season=conf.get("target_season", 1),
episode=conf.get("target_episode", 1),
@@ -94,7 +94,7 @@ def test_download_manifest_fetch(http_session, server_url: str, service_case) ->
timeout=240,
)
assert tr.status_code == 200, tr.text
track = _pick_track_at_height(tr.json().get("video") or [], target_height)
track = pick_track_at_height(tr.json().get("video") or [], target_height)
if not track:
pytest.skip(f"{service}: no track at height={target_height}")
+6 -6
View File
@@ -20,7 +20,7 @@ import pytest
pytestmark = [pytest.mark.live, pytest.mark.slow]
def _wait_titles(http_session, server_url: str, sid: str, timeout: float = 120.0):
def wait_titles(http_session, server_url: str, sid: str, timeout: float = 120.0):
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
r = http_session.get(f"{server_url}/api/session/{sid}/titles", timeout=30)
@@ -38,14 +38,14 @@ def _wait_titles(http_session, server_url: str, sid: str, timeout: float = 120.0
return None
def _pick_target_title(titles, season: int = 1, episode: int = 1):
def pick_target_title(titles, season: int = 1, episode: int = 1):
for t in titles:
if t.get("type") == "episode" and t.get("season") == season and t.get("number") == episode:
return t
return titles[0] if titles else None
def _pick_track_at_height(video_tracks, target_height: int):
def pick_track_at_height(video_tracks, target_height: int):
"""Prefer SDR + AVC at the requested height; smallest bitrate wins."""
same_height = [v for v in video_tracks if v.get("height") == target_height]
preferred = [v for v in same_height if v.get("codec") == "AVC" and v.get("range") == "SDR"]
@@ -80,10 +80,10 @@ def test_license_server_cdm(http_session, server_url: str, service_case) -> None
sid = r.json()["session_id"]
try:
body = _wait_titles(http_session, server_url, sid)
body = wait_titles(http_session, server_url, sid)
if not body:
pytest.skip(f"{service}: titles timeout")
target = _pick_target_title(
target = pick_target_title(
body.get("titles") or [],
season=conf.get("target_season", 1),
episode=conf.get("target_episode", 1),
@@ -97,7 +97,7 @@ def test_license_server_cdm(http_session, server_url: str, service_case) -> None
timeout=240,
)
assert tr.status_code == 200, tr.text
track = _pick_track_at_height(tr.json().get("video") or [], target_height)
track = pick_track_at_height(tr.json().get("video") or [], target_height)
if not track:
pytest.skip(f"{service}: no track at height={target_height}")
+11 -14
View File
@@ -18,11 +18,10 @@ import pytest
pytestmark = [pytest.mark.live, pytest.mark.slow]
def _create_session(http_session, server_url: str, service: str, title_id: str) -> str:
def create_session(http_session, server_url: str, service: str, title_id: str) -> str:
payload = {
"service": service,
"title_id": title_id,
# Quality knobs — send enum names the server's session_create parser accepts.
"range_": ["SDR", "HDR10", "DV"],
"vcodec": ["AVC", "HEVC"],
"best_available": True,
@@ -33,7 +32,7 @@ def _create_session(http_session, server_url: str, service: str, title_id: str)
return r.json()["session_id"]
def _wait_for_titles(http_session, server_url: str, sid: str, timeout: float = 120.0):
def wait_for_titles(http_session, server_url: str, sid: str, timeout: float = 120.0):
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
r = http_session.get(f"{server_url}/api/session/{sid}/titles", timeout=30)
@@ -51,7 +50,7 @@ def _wait_for_titles(http_session, server_url: str, sid: str, timeout: float = 1
return 408, {"message": "auth timeout"}
def _pick_target_title(titles: list[dict[str, Any]], season: int = 1, episode: int = 1) -> Optional[dict[str, Any]]:
def pick_target_title(titles: list[dict[str, Any]], season: int = 1, episode: int = 1) -> Optional[dict[str, Any]]:
"""Pick the configured target episode; fall back to the first title."""
for t in titles:
if t.get("type") == "episode" and t.get("season") == season and t.get("number") == episode:
@@ -59,7 +58,7 @@ def _pick_target_title(titles: list[dict[str, Any]], season: int = 1, episode: i
return titles[0] if titles else None
def _summarize(video_tracks: list[dict[str, Any]]) -> dict[str, Any]:
def summarize(video_tracks: list[dict[str, Any]]) -> dict[str, Any]:
max_height = max((v.get("height") or 0 for v in video_tracks), default=0)
max_width = max((v.get("width") or 0 for v in video_tracks), default=0)
codecs = sorted({v.get("codec") for v in video_tracks if v.get("codec")})
@@ -76,29 +75,28 @@ def _summarize(video_tracks: list[dict[str, Any]]) -> dict[str, Any]:
}
def _resolve_title_id(conf: dict) -> Optional[str]:
def resolve_title_id(conf: dict) -> Optional[str]:
"""Prefer series_url so S01E01 logic kicks in; fall back to movie title_url."""
return conf.get("series_url") or conf.get("title_url")
def test_track_quality_meets_expected(http_session, server_url: str, service_case, capsys) -> None:
service, conf = service_case
title_input = _resolve_title_id(conf)
title_input = resolve_title_id(conf)
if not title_input:
pytest.skip(f"{service}: no title_url/series_url in fixture")
sid = _create_session(http_session, server_url, service, title_input)
sid = create_session(http_session, server_url, service, title_input)
try:
code, body = _wait_for_titles(http_session, server_url, sid)
code, body = wait_for_titles(http_session, server_url, sid)
if code != 200:
pytest.skip(f"{service}: titles fetch failed {code}: {str(body)[:200]}")
titles = body.get("titles") or []
target = _pick_target_title(titles, season=conf.get("target_season", 1), episode=conf.get("target_episode", 1))
target = pick_target_title(titles, season=conf.get("target_season", 1), episode=conf.get("target_episode", 1))
if not target:
pytest.skip(f"{service}: no titles returned")
# Movies appear with type=='movie'; episodes with type=='episode'.
kind = target.get("type")
title_id = target.get("id")
if not title_id:
@@ -114,14 +112,13 @@ def test_track_quality_meets_expected(http_session, server_url: str, service_cas
tracks = r.json()
video = tracks.get("video") or []
summary = _summarize(video)
# Print summary even when test passes — discovery aid.
summary = summarize(video)
with capsys.disabled():
print(f"\n[{service}] target={kind} '{target.get('name')}' -> {summary}")
expected = conf.get("expected_quality") or {}
if not expected:
pytest.skip(f"{service}: no expected_quality in fixtures.yaml — discovered={summary}")
pytest.skip(f"{service}: no expected_quality in fixtures.yaml; discovered={summary}")
if "min_height" in expected:
assert summary["max_height"] >= expected["min_height"], (
+14 -17
View File
@@ -9,7 +9,7 @@ import pytest
pytestmark = [pytest.mark.live, pytest.mark.slow]
def _create_session(http_session, server_url: str, service: str, conf: dict) -> str:
def create_session(http_session, server_url: str, service: str, conf: dict) -> str:
payload = {"service": service, "title_id": conf["title_url"]}
r = http_session.post(f"{server_url}/api/session/create", json=payload, timeout=120)
if r.status_code >= 400:
@@ -20,7 +20,7 @@ def _create_session(http_session, server_url: str, service: str, conf: dict) ->
return sid
def _wait_for_titles(http_session, server_url: str, sid: str, timeout: float = 120.0):
def wait_for_titles(http_session, server_url: str, sid: str, timeout: float = 120.0):
"""Poll /titles until auth completes. Returns (status_code, response_json).
Server returns 400 + auth_status=authenticating while auth is in-flight,
@@ -44,31 +44,30 @@ def _wait_for_titles(http_session, server_url: str, sid: str, timeout: float = 1
return 408, {"message": "timeout waiting for auth"}
def _delete_session(http_session, server_url: str, sid: str) -> None:
def delete_session(http_session, server_url: str, sid: str) -> None:
http_session.delete(f"{server_url}/api/session/{sid}", timeout=30)
def test_session_create_then_delete(http_session, server_url: str, service_case) -> None:
service, conf = service_case
sid = _create_session(http_session, server_url, service, conf)
sid = create_session(http_session, server_url, service, conf)
try:
r = http_session.get(f"{server_url}/api/session/{sid}", timeout=30)
assert r.status_code == 200
info = r.json()
assert info.get("session", {}).get("service_tag", service) == service or service in str(info)
finally:
_delete_session(http_session, server_url, sid)
delete_session(http_session, server_url, sid)
# After delete, info should 404
r2 = http_session.get(f"{server_url}/api/session/{sid}", timeout=30)
assert r2.status_code == 404
def test_session_titles_returns_list(http_session, server_url: str, service_case) -> None:
service, conf = service_case
sid = _create_session(http_session, server_url, service, conf)
sid = create_session(http_session, server_url, service, conf)
try:
code, body = _wait_for_titles(http_session, server_url, sid)
code, body = wait_for_titles(http_session, server_url, sid)
if code != 200:
pytest.skip(f"{service}: titles fetch failed {code}: {str(body)[:200]}")
assert "titles" in body
@@ -78,14 +77,14 @@ def test_session_titles_returns_list(http_session, server_url: str, service_case
assert "id" in first
assert "type" in first
finally:
_delete_session(http_session, server_url, sid)
delete_session(http_session, server_url, sid)
def test_session_tracks_for_first_title(http_session, server_url: str, service_case) -> None:
service, conf = service_case
sid = _create_session(http_session, server_url, service, conf)
sid = create_session(http_session, server_url, service, conf)
try:
code, body = _wait_for_titles(http_session, server_url, sid)
code, body = wait_for_titles(http_session, server_url, sid)
if code != 200:
pytest.skip(f"{service}: titles fetch failed {code}: {str(body)[:200]}")
titles = body.get("titles") or []
@@ -99,18 +98,16 @@ def test_session_tracks_for_first_title(http_session, server_url: str, service_c
)
assert r.status_code == 200, r.text
body = r.json()
# Server returns a flat payload with `video`, `audio`, `subtitles`,
# `chapters`, `manifests`, `attachments` keys.
assert "video" in body or "audio" in body, body
assert body.get("video") or body.get("audio"), body
finally:
_delete_session(http_session, server_url, sid)
delete_session(http_session, server_url, sid)
def test_session_delete_idempotent_returns_404_after(http_session, server_url: str, service_case) -> None:
service, conf = service_case
sid = _create_session(http_session, server_url, service, conf)
_delete_session(http_session, server_url, sid)
sid = create_session(http_session, server_url, service, conf)
delete_session(http_session, server_url, sid)
r = http_session.delete(f"{server_url}/api/session/{sid}", timeout=30)
assert r.status_code in (404, 200) # tolerate both depending on server semantics
assert r.status_code in (404, 200)