From 44879b91c10a10d20af073cf948e72a465ce9719 Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Thu, 9 May 2024 15:57:44 -0400 Subject: [PATCH] Fix default trims for chat render & chat update --- TwitchDownloaderCLI/Models/TimeDuration.cs | 2 ++ TwitchDownloaderCLI/Modes/Arguments/ChatRenderArgs.cs | 4 ++-- TwitchDownloaderCLI/Modes/Arguments/ChatUpdateArgs.cs | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/TwitchDownloaderCLI/Models/TimeDuration.cs b/TwitchDownloaderCLI/Models/TimeDuration.cs index abf7489f..67daabf9 100644 --- a/TwitchDownloaderCLI/Models/TimeDuration.cs +++ b/TwitchDownloaderCLI/Models/TimeDuration.cs @@ -8,6 +8,8 @@ namespace TwitchDownloaderCLI.Models [DebuggerDisplay("{_timeSpan}")] public readonly record struct TimeDuration { + public static TimeDuration MinusOneSeconds { get; } = new(-1 * TimeSpan.TicksPerSecond); + private readonly TimeSpan _timeSpan; /// diff --git a/TwitchDownloaderCLI/Modes/Arguments/ChatRenderArgs.cs b/TwitchDownloaderCLI/Modes/Arguments/ChatRenderArgs.cs index 1098a9d8..29238b65 100644 --- a/TwitchDownloaderCLI/Modes/Arguments/ChatRenderArgs.cs +++ b/TwitchDownloaderCLI/Modes/Arguments/ChatRenderArgs.cs @@ -28,10 +28,10 @@ internal sealed class ChatRenderArgs : TwitchDownloaderArgs public int ChatHeight { get; set; } [Option('b', "beginning", HelpText = "Time to trim the beginning of the render. Can be milliseconds (#ms), seconds (#s), minutes (#m), hours (#h), or time (##:##:##).")] - public TimeDuration TrimBeginningTime { get; set; } = new(-1); + public TimeDuration TrimBeginningTime { get; set; } = TimeDuration.MinusOneSeconds; [Option('e', "ending", HelpText = "Time to trim the ending of the render. Can be milliseconds (#ms), seconds (#s), minutes (#m), hours (#h), or time (##:##:##).")] - public TimeDuration TrimEndingTime { get; set; } = new(-1); + public TimeDuration TrimEndingTime { get; set; } = TimeDuration.MinusOneSeconds; [Option("bttv", Default = true, HelpText = "Enable BTTV emotes.")] public bool? BttvEmotes { get; set; } diff --git a/TwitchDownloaderCLI/Modes/Arguments/ChatUpdateArgs.cs b/TwitchDownloaderCLI/Modes/Arguments/ChatUpdateArgs.cs index f41b23b4..7818dc6d 100644 --- a/TwitchDownloaderCLI/Modes/Arguments/ChatUpdateArgs.cs +++ b/TwitchDownloaderCLI/Modes/Arguments/ChatUpdateArgs.cs @@ -23,10 +23,10 @@ internal sealed class ChatUpdateArgs : TwitchDownloaderArgs public bool ReplaceEmbeds { get; set; } [Option('b', "beginning", HelpText = "New time for chat beginning. Can be milliseconds (#ms), seconds (#s), minutes (#m), hours (#h), or time (##:##:##). Comments may be added but not removed. -1 = Keep current trim.")] - public TimeDuration TrimBeginningTime { get; set; } = new(-1); + public TimeDuration TrimBeginningTime { get; set; } = TimeDuration.MinusOneSeconds; [Option('e', "ending", HelpText = "New time for chat ending. Can be milliseconds (#ms), seconds (#s), minutes (#m), hours (#h), or time (##:##:##). Comments may be added but not removed. -1 = Keep current trim.")] - public TimeDuration TrimEndingTime { get; set; } = new(-1); + public TimeDuration TrimEndingTime { get; set; } = TimeDuration.MinusOneSeconds; [Option("bttv", Default = true, HelpText = "Enable BTTV embedding in chat download.")] public bool? BttvEmotes { get; set; }