From 5a389314c2fecb1b00d7bbc15ccd11620b73c199 Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Wed, 25 Dec 2024 23:37:01 -0500 Subject: [PATCH] Fix being able to download chats before they start/after they end via the CLI --- TwitchDownloaderCore/ChatDownloader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TwitchDownloaderCore/ChatDownloader.cs b/TwitchDownloaderCore/ChatDownloader.cs index 0e20aaf0..1a3acee6 100644 --- a/TwitchDownloaderCore/ChatDownloader.cs +++ b/TwitchDownloaderCore/ChatDownloader.cs @@ -336,8 +336,8 @@ private async Task DownloadAsyncImpl(FileInfo outputFileInfo, FileStream outputF chatRoot.video.description = videoInfoResponse.data.video.description?.Replace(" \n", "\n").Replace("\n\n", "\n").TrimEnd(); chatRoot.video.title = videoInfoResponse.data.video.title; chatRoot.video.created_at = videoInfoResponse.data.video.createdAt; - chatRoot.video.start = downloadOptions.TrimBeginning ? downloadOptions.TrimBeginningTime : 0.0; - chatRoot.video.end = downloadOptions.TrimEnding ? downloadOptions.TrimEndingTime : videoInfoResponse.data.video.lengthSeconds; + chatRoot.video.start = downloadOptions.TrimBeginning ? Math.Max(0, downloadOptions.TrimBeginningTime) : 0.0; + chatRoot.video.end = downloadOptions.TrimEnding ? Math.Min(downloadOptions.TrimEndingTime, videoInfoResponse.data.video.lengthSeconds) : videoInfoResponse.data.video.lengthSeconds; chatRoot.video.length = videoInfoResponse.data.video.lengthSeconds; chatRoot.video.viewCount = videoInfoResponse.data.video.viewCount; chatRoot.video.game = videoInfoResponse.data.video.game?.displayName ?? "Unknown";