Set stop event & mark track failed if HLS Session DRM fails to license

This commit is contained in:
rlaphoenix 2023-05-19 18:59:36 +01:00
parent c9ecab444f
commit 6e844409ae
1 changed files with 10 additions and 4 deletions

View File

@ -215,12 +215,18 @@ class HLS:
sys.exit(1) sys.exit(1)
if track.drm: if track.drm:
session_drm = track.drm[0] # just use the first supported DRM system for now # TODO: What if we don't want to use the first DRM system?
session_drm = track.drm[0]
if isinstance(session_drm, Widevine): if isinstance(session_drm, Widevine):
# license and grab content keys # license and grab content keys
if not license_widevine: try:
raise ValueError("license_widevine func must be supplied to use Widevine DRM") if not license_widevine:
license_widevine(session_drm) raise ValueError("license_widevine func must be supplied to use Widevine DRM")
license_widevine(session_drm)
except Exception: # noqa
stop_event.set() # skip pending track downloads
progress(downloaded="[red]FAILED")
raise
else: else:
session_drm = None session_drm = None