refactor(drm): build PlayReady from base64 with PlayReady.from_pssh_b64 in server keys and the wire rebuild

This commit is contained in:
imSp4rky
2026-11-29 11:35:37 -07:00
parent 1cbaa2d307
commit 0ba9e6dfed
12 changed files with 182 additions and 55 deletions
@@ -13,7 +13,6 @@ import json
from types import SimpleNamespace
from uuid import UUID
import pyplayready.system.pssh as pr_pssh_mod
import pytest
from pyplayready.system.pssh import PSSH as RealPSSH
@@ -46,11 +45,6 @@ def _kidless_pro_b64() -> str:
return base64.b64encode(pro).decode()
class _FakePRPSSH:
def __init__(self, data):
self.data = data
class _FakePlayReady:
def __init__(self, pssh=None, pssh_b64=None, kid=None, **kwargs):
self.kids = [kid] if kid else [KID_A]
@@ -58,6 +52,10 @@ class _FakePlayReady:
self.pssh_b64 = pssh_b64
self.data = {"pssh_b64": pssh_b64} if pssh_b64 else {}
@classmethod
def from_pssh_b64(cls, pssh_b64, kid=None):
return cls(pssh_b64=pssh_b64, kid=kid)
@property
def kid(self):
return self.kids[0]
@@ -97,7 +95,6 @@ def server_env(monkeypatch):
@pytest.fixture
def fake_playready(monkeypatch):
monkeypatch.setattr(pr_pssh_mod, "PSSH", _FakePRPSSH)
monkeypatch.setattr(drm_mod, "PlayReady", _FakePlayReady)