Show Licensing and Licensed Messages via Rich

This commit is contained in:
rlaphoenix 2024-01-09 11:32:30 +00:00
parent 09edb696ba
commit d566aa2547
3 changed files with 11 additions and 0 deletions

View File

@ -913,7 +913,9 @@ class dl:
# license and grab content keys # license and grab content keys
if not prepare_drm: if not prepare_drm:
raise ValueError("prepare_drm func must be supplied to use Widevine DRM") raise ValueError("prepare_drm func must be supplied to use Widevine DRM")
progress(downloaded="LICENSING")
prepare_drm(drm, track_kid=track_kid) prepare_drm(drm, track_kid=track_kid)
progress(downloaded="[yellow]LICENSED")
else: else:
drm = None drm = None

View File

@ -397,7 +397,9 @@ class DASH:
try: try:
if not license_widevine: if not license_widevine:
raise ValueError("license_widevine func must be supplied to use Widevine DRM") raise ValueError("license_widevine func must be supplied to use Widevine DRM")
progress(downloaded="LICENSING")
license_widevine(drm, track_kid=track_kid) license_widevine(drm, track_kid=track_kid)
progress(downloaded="[yellow]LICENSED")
except Exception: # noqa except Exception: # noqa
stop_event.set() # skip pending track downloads stop_event.set() # skip pending track downloads
progress(downloaded="[red]FAILED") progress(downloaded="[red]FAILED")

View File

@ -227,7 +227,9 @@ class HLS:
try: try:
if not license_widevine: if not license_widevine:
raise ValueError("license_widevine func must be supplied to use Widevine DRM") raise ValueError("license_widevine func must be supplied to use Widevine DRM")
progress(downloaded="LICENSING")
license_widevine(session_drm) license_widevine(session_drm)
progress(downloaded="[yellow]LICENSED")
except Exception: # noqa except Exception: # noqa
stop_event.set() # skip pending track downloads stop_event.set() # skip pending track downloads
progress(downloaded="[red]FAILED") progress(downloaded="[red]FAILED")
@ -260,6 +262,7 @@ class HLS:
segment_key=segment_key, segment_key=segment_key,
range_offset=range_offset, range_offset=range_offset,
drm_lock=drm_lock, drm_lock=drm_lock,
progress=progress,
license_widevine=license_widevine, license_widevine=license_widevine,
session=session, session=session,
proxy=proxy, proxy=proxy,
@ -332,6 +335,7 @@ class HLS:
segment_key: Queue, segment_key: Queue,
range_offset: Queue, range_offset: Queue,
drm_lock: Lock, drm_lock: Lock,
progress: partial,
license_widevine: Optional[Callable] = None, license_widevine: Optional[Callable] = None,
session: Optional[Session] = None, session: Optional[Session] = None,
proxy: Optional[str] = None, proxy: Optional[str] = None,
@ -356,6 +360,7 @@ class HLS:
range_offset: Queue for saving and loading the most recent Segment Bytes Range. range_offset: Queue for saving and loading the most recent Segment Bytes Range.
drm_lock: Prevent more than one Download from doing anything DRM-related at the drm_lock: Prevent more than one Download from doing anything DRM-related at the
same time. Make sure all calls to download_segment() use the same Lock object. same time. Make sure all calls to download_segment() use the same Lock object.
progress: Rich Progress bar to provide progress updates to.
license_widevine: Function used to license Widevine DRM objects. It must be passed license_widevine: Function used to license Widevine DRM objects. It must be passed
if the Segment's DRM uses Widevine. if the Segment's DRM uses Widevine.
proxy: Proxy URI to use when downloading the Segment file. proxy: Proxy URI to use when downloading the Segment file.
@ -418,7 +423,9 @@ class HLS:
track_kid = track.get_key_id(newest_init_data) track_kid = track.get_key_id(newest_init_data)
if not license_widevine: if not license_widevine:
raise ValueError("license_widevine func must be supplied to use Widevine DRM") raise ValueError("license_widevine func must be supplied to use Widevine DRM")
progress(downloaded="LICENSING")
license_widevine(drm, track_kid=track_kid) license_widevine(drm, track_kid=track_kid)
progress(downloaded="[yellow]LICENSED")
newest_segment_key = (drm, segment.keys) newest_segment_key = (drm, segment.keys)
finally: finally:
segment_key.put(newest_segment_key) segment_key.put(newest_segment_key)