mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-03-12 01:19:02 +00:00
fix(hls): keep range offset numeric and align MonaLisa licensing
- Parse init section byterange offset as int to avoid string arithmetic bugs - Wrap MonaLisa licensing in the same progress + error handling flow as Widevine/PlayReady
This commit is contained in:
@@ -350,8 +350,16 @@ class HLS:
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
if not initial_drm_licensed and session_drm and isinstance(session_drm, MonaLisa):
|
if not initial_drm_licensed and session_drm and isinstance(session_drm, MonaLisa):
|
||||||
if license_widevine:
|
try:
|
||||||
|
if not license_widevine:
|
||||||
|
raise ValueError("license_widevine func must be supplied to use DRM")
|
||||||
|
progress(downloaded="LICENSING")
|
||||||
license_widevine(session_drm)
|
license_widevine(session_drm)
|
||||||
|
progress(downloaded="[yellow]LICENSED")
|
||||||
|
except Exception: # noqa
|
||||||
|
DOWNLOAD_CANCELLED.set() # skip pending track downloads
|
||||||
|
progress(downloaded="[red]FAILED")
|
||||||
|
raise
|
||||||
|
|
||||||
if DOWNLOAD_LICENCE_ONLY.is_set():
|
if DOWNLOAD_LICENCE_ONLY.is_set():
|
||||||
progress(downloaded="[yellow]SKIPPED")
|
progress(downloaded="[yellow]SKIPPED")
|
||||||
@@ -608,7 +616,7 @@ class HLS:
|
|||||||
if segment.init_section and (not map_data or segment.init_section != map_data[0]):
|
if segment.init_section and (not map_data or segment.init_section != map_data[0]):
|
||||||
if segment.init_section.byterange:
|
if segment.init_section.byterange:
|
||||||
init_byte_range = HLS.calculate_byte_range(segment.init_section.byterange, range_offset)
|
init_byte_range = HLS.calculate_byte_range(segment.init_section.byterange, range_offset)
|
||||||
range_offset = init_byte_range.split("-")[0]
|
range_offset = int(init_byte_range.split("-")[0])
|
||||||
init_range_header = {"Range": f"bytes={init_byte_range}"}
|
init_range_header = {"Range": f"bytes={init_byte_range}"}
|
||||||
else:
|
else:
|
||||||
init_range_header = {}
|
init_range_header = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user