Cdm: Fix typing of type_ param on get_license_challenge()

`LicenseType` shouldn't be used as a type-hint as its not a Type.
This commit is contained in:
rlaphoenix 2022-07-30 04:22:35 +01:00
parent 3afcf9c01c
commit 82d99d50d0
1 changed files with 4 additions and 1 deletions

View File

@ -152,7 +152,7 @@ class Cdm:
self.service_certificate = drm_certificate self.service_certificate = drm_certificate
return self.service_certificate.provider_id return self.service_certificate.provider_id
def get_license_challenge(self, type_: LicenseType = LicenseType.STREAMING, privacy_mode: bool = True) -> bytes: def get_license_challenge(self, type_: Union[int, str] = LicenseType.STREAMING, privacy_mode: bool = True) -> bytes:
""" """
Get a License Challenge to send to a License Server. Get a License Challenge to send to a License Server.
@ -167,6 +167,9 @@ class Cdm:
""" """
request_id = get_random_bytes(16) request_id = get_random_bytes(16)
if isinstance(type_, str):
type_ = LicenseType.Value(type_)
license_request = LicenseRequest() license_request = LicenseRequest()
license_request.type = LicenseRequest.RequestType.Value("NEW") license_request.type = LicenseRequest.RequestType.Value("NEW")
license_request.request_time = int(time.time()) license_request.request_time = int(time.time())