mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-27 03:15:08 +00:00
feat(remote): spoof a type-only CDM so server_cdm clients need no local .wvd/.prd
Stand in a SimpleNamespace CDM matching the server's DRM system when server_cdm is active and no local device is loaded, guarded on the resolved _server_cdm. Centralizes cdm_type_stub in cdm.detect, reused by the REST handlers.
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
from typing import Any
|
||||
|
||||
|
||||
def cdm_type_stub(cdm_type: str) -> SimpleNamespace:
|
||||
"""Type-only CDM stand-in so is_widevine_cdm()/is_playready_cdm() (and thus
|
||||
get_drm_for_cdm) route correctly without loading a real device. Used for
|
||||
server_cdm mode, where the server holds the device and returns the keys."""
|
||||
return SimpleNamespace(is_playready=cdm_type == "playready")
|
||||
|
||||
|
||||
def is_remote_cdm(cdm: Any) -> bool:
|
||||
"""
|
||||
Return True if a remote CDM or a service CDM backs the CDM instance.
|
||||
|
||||
Reference in New Issue
Block a user