From 837015b4eaa7f15215ecdc360e2fd34a0596f7de Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Thu, 15 Feb 2024 23:44:00 +0000 Subject: [PATCH] HLS: Fix incorrect last segment i when decrypting first segment --- devine/core/manifests/hls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devine/core/manifests/hls.py b/devine/core/manifests/hls.py index f9de82b..5166876 100644 --- a/devine/core/manifests/hls.py +++ b/devine/core/manifests/hls.py @@ -332,7 +332,7 @@ class HLS: """ drm = encryption_data[2] first_segment_i = encryption_data[0] - last_segment_i = i - int(not include_this_segment) + last_segment_i = max(0, i - int(not include_this_segment)) segment_range = f"{str(first_segment_i).zfill(name_len)}-{str(last_segment_i).zfill(name_len)}" merged_path = segment_save_dir / f"{segment_range}{Path(segments[last_segment_i].uri).suffix}"