Skip to content

Commit

Permalink
Fix TsMerger M3U8 support (lay295#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Jun 8, 2024
1 parent 25410bb commit 69e480c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions TwitchDownloaderCore/TsMerger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public async Task MergeAsync(CancellationToken cancellationToken)
}

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

if (isM3U8)
{
if (line.StartsWith('#')) continue;
}
else
{
if (line.StartsWith("#EXTM3U")) isM3U8 = true;
}
if (isFirst && line.StartsWith("#EXTM3U")) isM3U8 = true;

isFirst = false;

if (isM3U8 && line.StartsWith('#')) continue;

fileList.Add(line);
}
Expand Down

0 comments on commit 69e480c

Please sign in to comment.