From 85d1572392cd53c34eb91ac1e3c5394779df96dd Mon Sep 17 00:00:00 2001 From: nilaoda Date: Mon, 12 Dec 2022 01:41:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=AF=E8=83=BD=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84Index=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DownloadManager/SimpleLiveRecordManager2.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/N_m3u8DL-RE/DownloadManager/SimpleLiveRecordManager2.cs b/src/N_m3u8DL-RE/DownloadManager/SimpleLiveRecordManager2.cs index 2da0ee9..620c916 100644 --- a/src/N_m3u8DL-RE/DownloadManager/SimpleLiveRecordManager2.cs +++ b/src/N_m3u8DL-RE/DownloadManager/SimpleLiveRecordManager2.cs @@ -741,7 +741,22 @@ namespace N_m3u8DL_RE.DownloadManager if (index > -1) { - streamSpec.Playlist!.MediaParts[0].MediaSegments = streamSpec.Playlist!.MediaParts[0].MediaSegments.Skip(index + 1).ToList(); + //修正Index + var list = streamSpec.Playlist!.MediaParts[0].MediaSegments.Skip(index + 1).ToList(); + if (list.Count > 0) + { + var newMin = list.Min(s => s.Index); + var oldMax = streamSpec.Playlist!.MediaParts[0].MediaSegments.Max(s => s.Index); + if (newMin < oldMax) + { + var offset = oldMax - newMin + 1; + foreach (var item in list) + { + item.Index += offset; + } + } + } + streamSpec.Playlist!.MediaParts[0].MediaSegments = list; } }