HLS: Fix incorrect last segment i when decrypting first segment

This commit is contained in:
rlaphoenix 2024-02-15 23:44:00 +00:00
parent 1f11ed258b
commit 837015b4ea
1 changed files with 1 additions and 1 deletions

View File

@ -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}"