From 318832e6b2412ff4c94fe57a7ea0da27aec4d1ef Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 4 Mar 2023 11:49:53 +0000 Subject: [PATCH] Store DRM in the track.drm property in HLS and DASH --- devine/core/manifests/dash.py | 3 ++- devine/core/manifests/hls.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/devine/core/manifests/dash.py b/devine/core/manifests/dash.py index cd0c40c..ff35276 100644 --- a/devine/core/manifests/dash.py +++ b/devine/core/manifests/dash.py @@ -302,6 +302,7 @@ class DASH: adaptation_set.findall("ContentProtection") ) if drm: + track.drm = drm drm = drm[0] # just use the first supported DRM system for now if isinstance(drm, Widevine): # license and grab content keys @@ -336,7 +337,6 @@ class DASH: # Players would normally calculate segments via Byte-Ranges, but we don't care track.url = urljoin(period_base_url, base_url) track.descriptor = track.Descriptor.URL - track.drm = [drm] if drm else [] else: segments: list[tuple[str, Optional[str]]] = [] @@ -442,6 +442,7 @@ class DASH: # it might not have Widevine DRM, or might not have found the PSSH log.warning("No Widevine PSSH was found for this track, is it DRM free?") else: + track.drm = [drm] # license and grab content keys if not license_widevine: raise ValueError("license_widevine func must be supplied to use Widevine DRM") diff --git a/devine/core/manifests/hls.py b/devine/core/manifests/hls.py index 64f7d42..58bd194 100644 --- a/devine/core/manifests/hls.py +++ b/devine/core/manifests/hls.py @@ -242,6 +242,7 @@ class HLS: sys.exit(1) else: if drm: + track.drm = drm drm = drm[0] # just use the first supported DRM system for now log.debug("Got segment key, %s", drm) if isinstance(drm, Widevine):