diff --git a/src/N_m3u8DL-RE.Common/Resource/ResString.cs b/src/N_m3u8DL-RE.Common/Resource/ResString.cs index 5e76723..c872c04 100644 --- a/src/N_m3u8DL-RE.Common/Resource/ResString.cs +++ b/src/N_m3u8DL-RE.Common/Resource/ResString.cs @@ -54,6 +54,7 @@ namespace N_m3u8DL_RE.Common.Resource public static string cmd_savePattern { get => GetText("cmd_savePattern"); } public static string cmd_skipDownload { get => GetText("cmd_skipDownload"); } public static string cmd_noDateInfo { get => GetText("cmd_noDateInfo"); } + public static string cmd_noLog { get => GetText("cmd_noLog"); } public static string cmd_skipMerge { get => GetText("cmd_skipMerge"); } public static string cmd_subFormat { get => GetText("cmd_subFormat"); } public static string cmd_subOnly { get => GetText("cmd_subOnly"); } diff --git a/src/N_m3u8DL-RE.Common/Resource/StaticText.cs b/src/N_m3u8DL-RE.Common/Resource/StaticText.cs index 5395eee..e22cc4c 100644 --- a/src/N_m3u8DL-RE.Common/Resource/StaticText.cs +++ b/src/N_m3u8DL-RE.Common/Resource/StaticText.cs @@ -100,6 +100,12 @@ namespace N_m3u8DL_RE.Common.Resource zhTW: "混流時不寫入日期訊息", enUS: "Date information is not written during muxing" ), + ["cmd_noLog"] = new TextContainer + ( + zhCN: "关闭日志文件输出", + zhTW: "關閉日誌文件輸出", + enUS: "Disable log file output" + ), ["cmd_appendUrlParams"] = new TextContainer ( zhCN: "将输入Url的Params添加至分片, 对某些网站很有用, 例如 kakao.com", diff --git a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs index b75479c..1bd460a 100644 --- a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs +++ b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs @@ -54,6 +54,7 @@ namespace N_m3u8DL_RE.CommandLine private readonly static Option FFmpegBinaryPath = new(new string[] { "--ffmpeg-binary-path" }, description: ResString.cmd_ffmpegBinaryPath) { ArgumentHelpName = "PATH" }; private readonly static Option BaseUrl = new(new string[] { "--base-url" }, description: ResString.cmd_baseUrl); private readonly static Option ConcurrentDownload = new(new string[] { "-mt", "--concurrent-download" }, description: ResString.cmd_concurrentDownload, getDefaultValue: () => false); + private readonly static Option NoLog = new(new string[] { "--no-log" }, description: ResString.cmd_noLog, getDefaultValue: () => false); //代理选项 private readonly static Option UseSystemProxy = new(new string[] { "--use-system-proxy" }, description: ResString.cmd_useSystemProxy, getDefaultValue: () => true); @@ -424,6 +425,7 @@ namespace N_m3u8DL_RE.CommandLine CustomProxy = bindingContext.ParseResult.GetValueForOption(CustomProxy), LiveWaitTime = bindingContext.ParseResult.GetValueForOption(LiveWaitTime), NoDateInfo = bindingContext.ParseResult.GetValueForOption(NoDateInfo), + NoLog = bindingContext.ParseResult.GetValueForOption(NoLog), }; if (bindingContext.ParseResult.HasOption(CustomHLSMethod)) option.CustomHLSMethod = bindingContext.ParseResult.GetValueForOption(CustomHLSMethod); @@ -484,7 +486,7 @@ namespace N_m3u8DL_RE.CommandLine var rootCommand = new RootCommand(VERSION_INFO) { Input, TmpDir, SaveDir, SaveName, BaseUrl, ThreadCount, DownloadRetryCount, AutoSelect, SkipMerge, SkipDownload, CheckSegmentsCount, - BinaryMerge, DelAfterDone, NoDateInfo, WriteMetaJson, AppendUrlParams, ConcurrentDownload, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix, + BinaryMerge, DelAfterDone, NoDateInfo, NoLog, WriteMetaJson, AppendUrlParams, ConcurrentDownload, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix, FFmpegBinaryPath, LogLevel, UILanguage, UrlProcessorArgs, Keys, KeyTextFile, DecryptionBinaryPath, UseShakaPackager, MP4RealTimeDecryption, MuxAfterDone, diff --git a/src/N_m3u8DL-RE/CommandLine/MyOption.cs b/src/N_m3u8DL-RE/CommandLine/MyOption.cs index 5242fec..7716010 100644 --- a/src/N_m3u8DL-RE/CommandLine/MyOption.cs +++ b/src/N_m3u8DL-RE/CommandLine/MyOption.cs @@ -41,6 +41,10 @@ namespace N_m3u8DL_RE.CommandLine /// public bool NoDateInfo { get; set; } /// + /// See: . + /// + public bool NoLog { get; set; } + /// /// See: . /// public bool AutoSelect { get; set; } diff --git a/src/N_m3u8DL-RE/Program.cs b/src/N_m3u8DL-RE/Program.cs index 1bcebb2..5168a60 100644 --- a/src/N_m3u8DL-RE/Program.cs +++ b/src/N_m3u8DL-RE/Program.cs @@ -73,6 +73,7 @@ namespace N_m3u8DL_RE //检测更新 CheckUpdateAsync(); + Logger.IsWriteFile = !option.NoLog; Logger.InitLogFile(); Logger.LogLevel = option.LogLevel; Logger.Info(CommandInvoker.VERSION_INFO);