From 98a37711da794756c6989e1ea042e68fe906a3d3 Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Sun, 25 Feb 2024 14:55:44 -0500 Subject: [PATCH] Cleanup --- TwitchDownloaderCLI/Modes/MergeTs.cs | 2 ++ TwitchDownloaderCLI/README.md | 7 ++----- TwitchDownloaderCore/TsMerger.cs | 16 +++++++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/TwitchDownloaderCLI/Modes/MergeTs.cs b/TwitchDownloaderCLI/Modes/MergeTs.cs index 04edc5f8..13c41c65 100644 --- a/TwitchDownloaderCLI/Modes/MergeTs.cs +++ b/TwitchDownloaderCLI/Modes/MergeTs.cs @@ -11,6 +11,8 @@ internal static class MergeTs { internal static void Merge(TsMergeArgs inputOptions) { + Console.WriteLine("[INFO] The TS merger is experimental and is subject to change without notice in future releases."); + Progress progress = new(); progress.ProgressChanged += ProgressHandler.Progress_ProgressChanged; diff --git a/TwitchDownloaderCLI/README.md b/TwitchDownloaderCLI/README.md index ea57d57f..5d4b5ebe 100644 --- a/TwitchDownloaderCLI/README.md +++ b/TwitchDownloaderCLI/README.md @@ -434,8 +434,5 @@ For Linux users, ensure both `fontconfig` and `libfontconfig1` are installed. `a Some distros, like Linux Alpine, lack fonts for some languages (Arabic, Persian, Thai, etc.) If this is the case for you, install additional fonts families such as [Noto](https://fonts.google.com/noto/specimen/Noto+Sans) or check your distro's wiki page on fonts as it may have an install command for this specific scenario, such as the [Linux Alpine](https://wiki.alpinelinux.org/wiki/Fonts) font page. -The list file for tsmerge can contain relative or absolute paths, but the path format differs from Windows to Linux/UNIX/MacOS (like volume paths or "/" instead of "\" to separate directories). -The list must be a text file and describe one ts path per line. - -The concatenation made by tsmerge is not a raw (binary) concatenation, like `dd`, `cat` or `pv` would do on Linux, or `copy /b` on Windows. -Instead, the streams have to be partially recoded, to keep its structure valid and playable. Using other software may not achieve this result. +The list file for `tsmerge` may contain relative or absolute paths, with one path per line. +Alternatively, the list file may also be an M3U8 playlist file. \ No newline at end of file diff --git a/TwitchDownloaderCore/TsMerger.cs b/TwitchDownloaderCore/TsMerger.cs index b6193f10..e3e54128 100644 --- a/TwitchDownloaderCore/TsMerger.cs +++ b/TwitchDownloaderCore/TsMerger.cs @@ -26,17 +26,23 @@ public async Task MergeAsync(CancellationToken cancellationToken) throw new FileNotFoundException("Input file does not exist"); } + var isM3U8 = false; var fileList = new List(); await using (var fs = File.Open(mergeOptions.InputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { using var sr = new StreamReader(fs); while (await sr.ReadLineAsync() is { } line) { - if (string.IsNullOrWhiteSpace(line)) - continue; + if (string.IsNullOrWhiteSpace(line)) continue; - if (line.StartsWith('#')) - continue; + if (isM3U8) + { + if (line.StartsWith('#')) continue; + } + else + { + if (line.StartsWith("#EXTM3U")) isM3U8 = true; + } fileList.Add(line); } @@ -83,7 +89,7 @@ private async Task VerifyVideoParts(IReadOnlyCollection fileList, Cancel return; } - _progress.Report(new ProgressReport(ReportType.Log, $"The following TS files appear to be invalid or corrupted: {string.Join(", ", failedParts)}")); + _progress.Report(new ProgressReport(ReportType.Log, $"The following TS files are invalid or corrupted: {string.Join(", ", failedParts)}")); } }