diff --git a/pywidevine/cdm.py b/pywidevine/cdm.py index f0f76f4..56b93ed 100644 --- a/pywidevine/cdm.py +++ b/pywidevine/cdm.py @@ -66,7 +66,7 @@ class Cdm: def __init__( self, - device_type: Device.Types, + device_type: Union[Device.Types, str], system_id: int, security_level: int, client_id: ClientIdentification, @@ -75,6 +75,8 @@ class Cdm: """Initialize a Widevine Content Decryption Module (CDM).""" if not device_type: raise ValueError("Device Type must be provided") + if isinstance(device_type, str): + device_type = Device.Types[device_type] if not isinstance(device_type, Device.Types): raise TypeError(f"Expected device_type to be a {Device.Types!r} not {device_type!r}") diff --git a/pywidevine/remotecdm.py b/pywidevine/remotecdm.py index 1786427..be7ed22 100644 --- a/pywidevine/remotecdm.py +++ b/pywidevine/remotecdm.py @@ -24,7 +24,7 @@ class RemoteCdm(Cdm): def __init__( self, - device_type: Device.Types, + device_type: Union[Device.Types, str], system_id: int, security_level: int, host: str, @@ -34,6 +34,8 @@ class RemoteCdm(Cdm): """Initialize a Widevine Content Decryption Module (CDM).""" if not device_type: raise ValueError("Device Type must be provided") + if isinstance(device_type, str): + device_type = Device.Types[device_type] if not isinstance(device_type, Device.Types): raise TypeError(f"Expected device_type to be a {Device.Types!r} not {device_type!r}")