Skip to content

Commit 69e480c

Browse files
committed
Fix TsMerger M3U8 support (lay295#1084)
1 parent 25410bb commit 69e480c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

TwitchDownloaderCore/TsMerger.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public async Task MergeAsync(CancellationToken cancellationToken)
2727
}
2828

2929
var isM3U8 = false;
30+
var isFirst = true;
3031
var fileList = new List<string>();
3132
await using (var fs = File.Open(mergeOptions.InputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
3233
{
@@ -35,14 +36,11 @@ public async Task MergeAsync(CancellationToken cancellationToken)
3536
{
3637
if (string.IsNullOrWhiteSpace(line)) continue;
3738

38-
if (isM3U8)
39-
{
40-
if (line.StartsWith('#')) continue;
41-
}
42-
else
43-
{
44-
if (line.StartsWith("#EXTM3U")) isM3U8 = true;
45-
}
39+
if (isFirst && line.StartsWith("#EXTM3U")) isM3U8 = true;
40+
41+
isFirst = false;
42+
43+
if (isM3U8 && line.StartsWith('#')) continue;
4644

4745
fileList.Add(line);
4846
}

0 commit comments

Comments
 (0)