fix(cdm): keep remote CDM state per session in one shared HttpCdm base

This commit is contained in:
imSp4rky
2026-11-25 14:50:42 -07:00
parent 0a1a7d759f
commit b6c6d317a9
12 changed files with 942 additions and 1268 deletions
+8 -1
View File
@@ -10,6 +10,7 @@ from pyplayready.misc.exceptions import InvalidLicense, InvalidXmrLicense
from pyplayready.system.pssh import PSSH
from pyplayready.system.wrmheader import WRMHeader
from unshackle.core.cdm.http_cdm import HttpCdm
from unshackle.core.drm import PlayReady
KID_A = UUID("00112233-4455-6677-8899-aabbccddeeff")
@@ -45,7 +46,7 @@ class FakeKey:
self.key = bytes.fromhex(key)
class FakeCdm:
class FakeCdm(HttpCdm):
"""Answers each challenge with the keys mapped for the header's KIDs; records what it saw."""
def __init__(self, answers: dict[UUID, str], fail_on: set[UUID] | None = None) -> None:
@@ -86,6 +87,12 @@ class FakeCdm:
def get_keys(self, session_id: str) -> list[FakeKey]:
return [FakeKey(kid, self.answers[kid]) for kid in self._by_session[session_id] if kid in self.answers]
def _request_challenge(self, *_: Any) -> bytes:
raise NotImplementedError
def _request_keys(self, *_: Any) -> list[dict[str, Any]]:
raise NotImplementedError
def _licence(**_: Any) -> str:
return "<License>x</License>"