diff --git a/TwitchDownloaderCLI/Modes/Arguments/VideoDownloadArgs.cs b/TwitchDownloaderCLI/Modes/Arguments/VideoDownloadArgs.cs index 9acd96d1..c4e6249d 100644 --- a/TwitchDownloaderCLI/Modes/Arguments/VideoDownloadArgs.cs +++ b/TwitchDownloaderCLI/Modes/Arguments/VideoDownloadArgs.cs @@ -1,4 +1,4 @@ -using CommandLine; +using CommandLine; namespace TwitchDownloaderCLI.Modes.Arguments { @@ -14,6 +14,12 @@ public class VideoDownloadArgs : ITwitchDownloaderArgs [Option('q', "quality", HelpText = "The quality the program will attempt to download.")] public string Quality { get; set; } + [Option('K', "keepcache", Required = false, HelpText = "Keep entire cache folder. Overrides \"-k\".")] + public bool KeepCache { get; set; } + + [Option('k', "keepcachenoparts", Required = false, HelpText = "Keep cache folder except .ts parts.")] + public bool KeepCacheNoParts { get; set; } + [Option('b', "beginning", HelpText = "Time in seconds to crop beginning.")] public int CropBeginningTime { get; set; } diff --git a/TwitchDownloaderCLI/Modes/DownloadVideo.cs b/TwitchDownloaderCLI/Modes/DownloadVideo.cs index 0a5bf4c0..03f288ea 100644 --- a/TwitchDownloaderCLI/Modes/DownloadVideo.cs +++ b/TwitchDownloaderCLI/Modes/DownloadVideo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading; using TwitchDownloaderCLI.Modes.Arguments; @@ -70,6 +70,8 @@ private static VideoDownloadOptions GetDownloadOptions(VideoDownloadArgs inputOp ".m4a" => "Audio", _ => throw new ArgumentException("Only MP4 and M4A audio files are supported.") }, + KeepCache = inputOptions.KeepCache, + KeepCacheNoParts = inputOptions.KeepCacheNoParts, CropBeginning = inputOptions.CropBeginningTime > 0.0, CropBeginningTime = inputOptions.CropBeginningTime, CropEnding = inputOptions.CropEndingTime > 0.0, @@ -81,4 +83,4 @@ private static VideoDownloadOptions GetDownloadOptions(VideoDownloadArgs inputOp return downloadOptions; } } -} \ No newline at end of file +} diff --git a/TwitchDownloaderCLI/README.md b/TwitchDownloaderCLI/README.md index 5d4b5ebe..f0cedd1b 100644 --- a/TwitchDownloaderCLI/README.md +++ b/TwitchDownloaderCLI/README.md @@ -28,6 +28,12 @@ File the program will output to. File extension will be used to determine downlo **-q / --quality** The quality the program will attempt to download, for example "1080p60", if not found will download highest quality stream. +**-K / --keepcache** +Keep entire cache folder. Overrides "-k". + +**-k / --keepcachenoparts** +Keep cache folder except .ts parts. + **-b / --beginning** Time in seconds to crop beginning. For example if I had a 10 second stream but only wanted the last 7 seconds of it I would use `-b 3` to skip the first 3 seconds. @@ -435,4 +441,4 @@ 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` 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 +Alternatively, the list file may also be an M3U8 playlist file. diff --git a/TwitchDownloaderCore/Options/VideoDownloadOptions.cs b/TwitchDownloaderCore/Options/VideoDownloadOptions.cs index 89c1c22f..f405d306 100644 --- a/TwitchDownloaderCore/Options/VideoDownloadOptions.cs +++ b/TwitchDownloaderCore/Options/VideoDownloadOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; namespace TwitchDownloaderCore.Options @@ -8,6 +8,8 @@ public class VideoDownloadOptions public int Id { get; set; } public string Quality { get; set; } public string Filename { get; set; } + public bool KeepCache { get; set; } + public bool KeepCacheNoParts { get; set; } public bool CropBeginning { get; set; } public double CropBeginningTime { get; set; } public bool CropEnding { get; set; } diff --git a/TwitchDownloaderCore/VideoDownloader.cs b/TwitchDownloaderCore/VideoDownloader.cs index 00800416..f78cec28 100644 --- a/TwitchDownloaderCore/VideoDownloader.cs +++ b/TwitchDownloaderCore/VideoDownloader.cs @@ -32,6 +32,8 @@ public VideoDownloader(VideoDownloadOptions videoDownloadOptions, IProgress