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
+1 -2
View File
@@ -23,7 +23,6 @@ from uuid import UUID
import click
from langcodes import Language
from pyplayready.system.pssh import PSSH as PlayReadyPSSH
from pywidevine.pssh import PSSH as WidevinePSSH
from unshackle.core.config import config
@@ -402,7 +401,7 @@ def pssh_drm(system: str, pssh_b64: str, kids: list[str] | None) -> Widevine | P
kids repeats the PSSH KIDs, so kids[0] is not the track's own KID; only a PSSH without KIDs needs it.
"""
if system == "playready":
return PlayReady(pssh=PlayReadyPSSH(base64.b64decode(pssh_b64)), pssh_b64=pssh_b64)
return PlayReady.from_pssh_b64(pssh_b64)
wv_pssh = WidevinePSSH(pssh_b64)
return Widevine(pssh=wv_pssh, kid=kids[0] if kids and not wv_pssh.key_ids else None)