From b7a479e585a3d22d8aad4664c394e1e3443ae023 Mon Sep 17 00:00:00 2001 From: mediaminister <45148099+mediaminister@users.noreply.github.com> Date: Thu, 15 Dec 2022 11:36:51 +0100 Subject: [PATCH] Add support for unprotected MPEG-DASH streams (#111) --- resources/lib/viervijfzes/content.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/resources/lib/viervijfzes/content.py b/resources/lib/viervijfzes/content.py index 3517219..4c9f8cd 100644 --- a/resources/lib/viervijfzes/content.py +++ b/resources/lib/viervijfzes/content.py @@ -361,23 +361,33 @@ class ContentApi: raise UnavailableException if 'videoDash' in data: - # DRM protected stream - # See https://docs.unified-streaming.com/documentation/drm/buydrm.html#setting-up-the-client - drm_key = data['drmKey']['S'] - _LOGGER.debug('Fetching Authentication XML with drm_key %s', drm_key) - response_drm = self._get_url(self.API_GOPLAY + '/video/xml/%s' % drm_key, authentication=self._auth.get_token()) - data_drm = json.loads(response_drm) + if 'drmKey' in data: + # DRM protected stream + # See https://docs.unified-streaming.com/documentation/drm/buydrm.html#setting-up-the-client + drm_key = data['drmKey']['S'] + _LOGGER.debug('Fetching Authentication XML with drm_key %s', drm_key) + response_drm = self._get_url(self.API_GOPLAY + '/video/xml/%s' % drm_key, authentication=self._auth.get_token()) + data_drm = json.loads(response_drm) + + # DRM protected DASH stream + return ResolvedStream( + uuid=uuid, + url=data['videoDash']['S'], + stream_type=STREAM_DASH, + license_url='https://wv-keyos.licensekeyserver.com/', + auth=data_drm.get('auth'), + ) + + # Unprotected DASH stream return ResolvedStream( uuid=uuid, url=data['videoDash']['S'], stream_type=STREAM_DASH, - license_url='https://wv-keyos.licensekeyserver.com/', - auth=data_drm.get('auth'), ) - # Normal HLS stream + # Unprotected HLS stream return ResolvedStream( uuid=uuid, url=data['video']['S'],