优化帮助文档,增加`--more-help`
This commit is contained in:
parent
5cea80476d
commit
0b02ecd2c8
|
@ -26,11 +26,16 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
public static string cmd_ffmpegBinaryPath { get => GetText("cmd_ffmpegBinaryPath"); }
|
public static string cmd_ffmpegBinaryPath { get => GetText("cmd_ffmpegBinaryPath"); }
|
||||||
public static string cmd_mkvmergeBinaryPath { get => GetText("cmd_mkvmergeBinaryPath"); }
|
public static string cmd_mkvmergeBinaryPath { get => GetText("cmd_mkvmergeBinaryPath"); }
|
||||||
public static string cmd_baseUrl { get => GetText("cmd_baseUrl"); }
|
public static string cmd_baseUrl { get => GetText("cmd_baseUrl"); }
|
||||||
|
public static string cmd_moreHelp { get => GetText("cmd_moreHelp"); }
|
||||||
public static string cmd_header { get => GetText("cmd_header"); }
|
public static string cmd_header { get => GetText("cmd_header"); }
|
||||||
public static string cmd_muxImport { get => GetText("cmd_muxImport"); }
|
public static string cmd_muxImport { get => GetText("cmd_muxImport"); }
|
||||||
|
public static string cmd_muxImport_more { get => GetText("cmd_muxImport_more"); }
|
||||||
public static string cmd_selectVideo { get => GetText("cmd_selectVideo"); }
|
public static string cmd_selectVideo { get => GetText("cmd_selectVideo"); }
|
||||||
|
public static string cmd_selectVideo_more { get => GetText("cmd_selectVideo_more"); }
|
||||||
public static string cmd_selectAudio { get => GetText("cmd_selectAudio"); }
|
public static string cmd_selectAudio { get => GetText("cmd_selectAudio"); }
|
||||||
|
public static string cmd_selectAudio_more { get => GetText("cmd_selectAudio_more"); }
|
||||||
public static string cmd_selectSubtitle { get => GetText("cmd_selectSubtitle"); }
|
public static string cmd_selectSubtitle { get => GetText("cmd_selectSubtitle"); }
|
||||||
|
public static string cmd_selectSubtitle_more { get => GetText("cmd_selectSubtitle_more"); }
|
||||||
public static string cmd_Input { get => GetText("cmd_Input"); }
|
public static string cmd_Input { get => GetText("cmd_Input"); }
|
||||||
public static string cmd_keys { get => GetText("cmd_keys"); }
|
public static string cmd_keys { get => GetText("cmd_keys"); }
|
||||||
public static string cmd_keyText { get => GetText("cmd_keyText"); }
|
public static string cmd_keyText { get => GetText("cmd_keyText"); }
|
||||||
|
@ -57,6 +62,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
public static string cmd_liveRealTimeMerge { get => GetText("cmd_liveRealTimeMerge"); }
|
public static string cmd_liveRealTimeMerge { get => GetText("cmd_liveRealTimeMerge"); }
|
||||||
public static string cmd_livePerformAsVod { get => GetText("cmd_livePerformAsVod"); }
|
public static string cmd_livePerformAsVod { get => GetText("cmd_livePerformAsVod"); }
|
||||||
public static string cmd_muxAfterDone { get => GetText("cmd_muxAfterDone"); }
|
public static string cmd_muxAfterDone { get => GetText("cmd_muxAfterDone"); }
|
||||||
|
public static string cmd_muxAfterDone_more { get => GetText("cmd_muxAfterDone_more"); }
|
||||||
public static string cmd_writeMetaJson { get => GetText("cmd_writeMetaJson"); }
|
public static string cmd_writeMetaJson { get => GetText("cmd_writeMetaJson"); }
|
||||||
public static string liveLimit { get => GetText("liveLimit"); }
|
public static string liveLimit { get => GetText("liveLimit"); }
|
||||||
public static string liveLimitReached { get => GetText("liveLimitReached"); }
|
public static string liveLimitReached { get => GetText("liveLimitReached"); }
|
||||||
|
|
|
@ -226,6 +226,12 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
zhTW: "設置UI語言",
|
zhTW: "設置UI語言",
|
||||||
enUS: "Set UI language"
|
enUS: "Set UI language"
|
||||||
),
|
),
|
||||||
|
["cmd_moreHelp"] = new TextContainer
|
||||||
|
(
|
||||||
|
zhCN: "查看某个选项的详细帮助信息",
|
||||||
|
zhTW: "查看某個選項的詳細幫助訊息",
|
||||||
|
enUS: "Set more help info about one option"
|
||||||
|
),
|
||||||
["cmd_urlProcessorArgs"] = new TextContainer
|
["cmd_urlProcessorArgs"] = new TextContainer
|
||||||
(
|
(
|
||||||
zhCN: "此字符串将直接传递给URL Processor",
|
zhCN: "此字符串将直接传递给URL Processor",
|
||||||
|
@ -269,6 +275,12 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
enUS: "Concurrently download the selected audio, video and subtitles"
|
enUS: "Concurrently download the selected audio, video and subtitles"
|
||||||
),
|
),
|
||||||
["cmd_selectVideo"] = new TextContainer
|
["cmd_selectVideo"] = new TextContainer
|
||||||
|
(
|
||||||
|
zhCN: "通过正则表达式选择符合要求的视频流. 输入 \"--morehelp select-video\" 以查看详细信息.",
|
||||||
|
zhTW: "通過正則表達式選擇符合要求的影片軌. 輸入 \"--morehelp select-video\" 以查看詳細訊息.",
|
||||||
|
enUS: "Select video streams by regular expressions. Use \"--morehelp select-video\" for more details."
|
||||||
|
),
|
||||||
|
["cmd_selectVideo_more"] = new TextContainer
|
||||||
(
|
(
|
||||||
zhCN: "通过正则表达式选择符合要求的视频流. 你能够以:分隔形式指定如下参数:\r\n\r\n" +
|
zhCN: "通过正则表达式选择符合要求的视频流. 你能够以:分隔形式指定如下参数:\r\n\r\n" +
|
||||||
"id=REGEX:lang=REGEX:name=REGEX:codec=REGEX:res=REGEX\r\n" +
|
"id=REGEX:lang=REGEX:name=REGEX:codec=REGEX:res=REGEX\r\n" +
|
||||||
|
@ -299,6 +311,12 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"-sv res=\"3840*\":codec=hvc1:for=best\r\n"
|
"-sv res=\"3840*\":codec=hvc1:for=best\r\n"
|
||||||
),
|
),
|
||||||
["cmd_selectAudio"] = new TextContainer
|
["cmd_selectAudio"] = new TextContainer
|
||||||
|
(
|
||||||
|
zhCN: "通过正则表达式选择符合要求的音频流. 输入 \"--morehelp select-audio\" 以查看详细信息.",
|
||||||
|
zhTW: "通過正則表達式選擇符合要求的音軌. 輸入 \"--morehelp select-audio\" 以查看詳細訊息.",
|
||||||
|
enUS: "Select audio streams by regular expressions. Use \"--morehelp select-audio\" for more details."
|
||||||
|
),
|
||||||
|
["cmd_selectAudio_more"] = new TextContainer
|
||||||
(
|
(
|
||||||
zhCN: "通过正则表达式选择符合要求的音频流. 参考 --select-video\r\n\r\n" +
|
zhCN: "通过正则表达式选择符合要求的音频流. 参考 --select-video\r\n\r\n" +
|
||||||
"例如: \r\n" +
|
"例如: \r\n" +
|
||||||
|
@ -326,6 +344,12 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"-sa lang=\"ja|en\":for=best2\r\n"
|
"-sa lang=\"ja|en\":for=best2\r\n"
|
||||||
),
|
),
|
||||||
["cmd_selectSubtitle"] = new TextContainer
|
["cmd_selectSubtitle"] = new TextContainer
|
||||||
|
(
|
||||||
|
zhCN: "通过正则表达式选择符合要求的字幕流. 输入 \"--morehelp select-subtitle\" 以查看详细信息.",
|
||||||
|
zhTW: "通過正則表達式選擇符合要求的字幕流. 輸入 \"--morehelp select-subtitle\" 以查看詳細訊息.",
|
||||||
|
enUS: "Select subtitle streams by regular expressions. Use \"--morehelp select-subtitle\" for more details."
|
||||||
|
),
|
||||||
|
["cmd_selectSubtitle_more"] = new TextContainer
|
||||||
(
|
(
|
||||||
zhCN: "通过正则表达式选择符合要求的字幕流. 参考 --select-video\r\n\r\n" +
|
zhCN: "通过正则表达式选择符合要求的字幕流. 参考 --select-video\r\n\r\n" +
|
||||||
"例如: \r\n" +
|
"例如: \r\n" +
|
||||||
|
@ -346,7 +370,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"# select all subs containing \"English\"\r\n" +
|
"# select all subs containing \"English\"\r\n" +
|
||||||
"-ss name=\"English\":for=all\r\n"
|
"-ss name=\"English\":for=all\r\n"
|
||||||
),
|
),
|
||||||
["cmd_muxAfterDone"] = new TextContainer
|
["cmd_muxAfterDone_more"] = new TextContainer
|
||||||
(
|
(
|
||||||
zhCN: "所有工作完成时尝试混流分离的音视频. 你能够以:分隔形式指定如下参数:\r\n\r\n" +
|
zhCN: "所有工作完成时尝试混流分离的音视频. 你能够以:分隔形式指定如下参数:\r\n\r\n" +
|
||||||
"* format=FORMAT: 指定混流容器 mkv, mp4\r\n" +
|
"* format=FORMAT: 指定混流容器 mkv, mp4\r\n" +
|
||||||
|
@ -385,7 +409,19 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
"# use mkvmerge, set bin path\r\n" +
|
"# use mkvmerge, set bin path\r\n" +
|
||||||
"-M format=mkv:muxer=mkvmerge:bin_path=\"C\\:\\Program Files\\MKVToolNix\\mkvmerge.exe\"\r\n"
|
"-M format=mkv:muxer=mkvmerge:bin_path=\"C\\:\\Program Files\\MKVToolNix\\mkvmerge.exe\"\r\n"
|
||||||
),
|
),
|
||||||
|
["cmd_muxAfterDone"] = new TextContainer
|
||||||
|
(
|
||||||
|
zhCN: "所有工作完成时尝试混流分离的音视频. 输入 \"--morehelp mux-after-done\" 以查看详细信息.",
|
||||||
|
zhTW: "所有工作完成時嘗試混流分離的影音. 輸入 \"--morehelp mux-after-done\" 以查看詳細訊息.",
|
||||||
|
enUS: "When all works is done, try to mux the downloaded streams. Use \"--morehelp mux-after-done\" for more details."
|
||||||
|
),
|
||||||
["cmd_muxImport"] = new TextContainer
|
["cmd_muxImport"] = new TextContainer
|
||||||
|
(
|
||||||
|
zhCN: "混流时引入外部媒体文件. 输入 \"--morehelp mux-import\" 以查看详细信息.",
|
||||||
|
zhTW: "混流時引入外部媒體檔案. 輸入 \"--morehelp mux-import\" 以查看詳細訊息.",
|
||||||
|
enUS: "When MuxAfterDone enabled, allow to import local media files. Use \"--morehelp mux-import\" for more details."
|
||||||
|
),
|
||||||
|
["cmd_muxImport_more"] = new TextContainer
|
||||||
(
|
(
|
||||||
zhCN: "混流时引入外部媒体文件. 你能够以:分隔形式指定如下参数:\r\n\r\n" +
|
zhCN: "混流时引入外部媒体文件. 你能够以:分隔形式指定如下参数:\r\n\r\n" +
|
||||||
"* path=PATH: 指定媒体文件路径\r\n" +
|
"* path=PATH: 指定媒体文件路径\r\n" +
|
||||||
|
|
|
@ -48,6 +48,9 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
private readonly static Option<string?> BaseUrl = new(new string[] { "--base-url" }, description: ResString.cmd_baseUrl);
|
private readonly static Option<string?> BaseUrl = new(new string[] { "--base-url" }, description: ResString.cmd_baseUrl);
|
||||||
private readonly static Option<bool> ConcurrentDownload = new(new string[] { "-mt", "--concurrent-download" }, description: ResString.cmd_concurrentDownload, getDefaultValue: () => false);
|
private readonly static Option<bool> ConcurrentDownload = new(new string[] { "-mt", "--concurrent-download" }, description: ResString.cmd_concurrentDownload, getDefaultValue: () => false);
|
||||||
|
|
||||||
|
//morehelp
|
||||||
|
private readonly static Option<string?> MoreHelp = new(new string[] { "--morehelp" }, description: ResString.cmd_moreHelp) { ArgumentHelpName = "OPTION" };
|
||||||
|
|
||||||
//直播相关
|
//直播相关
|
||||||
private readonly static Option<bool> LivePerformAsVod = new(new string[] { "--live-perform-as-vod" }, description: ResString.cmd_livePerformAsVod, getDefaultValue: () => false);
|
private readonly static Option<bool> LivePerformAsVod = new(new string[] { "--live-perform-as-vod" }, description: ResString.cmd_livePerformAsVod, getDefaultValue: () => false);
|
||||||
private readonly static Option<bool> LiveRealTimeMerge = new(new string[] { "--live-real-time-merge" }, description: ResString.cmd_liveRealTimeMerge, getDefaultValue: () => false);
|
private readonly static Option<bool> LiveRealTimeMerge = new(new string[] { "--live-real-time-merge" }, description: ResString.cmd_liveRealTimeMerge, getDefaultValue: () => false);
|
||||||
|
@ -334,7 +337,25 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
|
|
||||||
public static async Task<int> InvokeArgs(string[] args, Func<MyOption, Task> action)
|
public static async Task<int> InvokeArgs(string[] args, Func<MyOption, Task> action)
|
||||||
{
|
{
|
||||||
var rootCommand = new RootCommand("N_m3u8DL-RE (Beta version) 20220919")
|
var argList = new List<string>(args);
|
||||||
|
var index = -1;
|
||||||
|
if ((index = argList.IndexOf("--morehelp")) == 0 && argList.Count == 2)
|
||||||
|
{
|
||||||
|
var option = argList[index + 1];
|
||||||
|
var msg = option switch
|
||||||
|
{
|
||||||
|
"mux-after-done" => ResString.cmd_muxAfterDone_more,
|
||||||
|
"mux-import" => ResString.cmd_muxImport_more,
|
||||||
|
"select-video" => ResString.cmd_selectVideo_more,
|
||||||
|
"select-audio" => ResString.cmd_selectAudio_more,
|
||||||
|
"select-subtitle" => ResString.cmd_selectSubtitle_more,
|
||||||
|
_ => $"Option=\"{option}\" not found"
|
||||||
|
};
|
||||||
|
Console.WriteLine($"More Help:\r\n\r\n --{option}\r\n\r\n" + msg);
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var rootCommand = new RootCommand("N_m3u8DL-RE (Beta version) 20220920")
|
||||||
{
|
{
|
||||||
Input, TmpDir, SaveDir, SaveName, BaseUrl, ThreadCount, DownloadRetryCount, AutoSelect, SkipMerge, SkipDownload, CheckSegmentsCount,
|
Input, TmpDir, SaveDir, SaveName, BaseUrl, ThreadCount, DownloadRetryCount, AutoSelect, SkipMerge, SkipDownload, CheckSegmentsCount,
|
||||||
BinaryMerge, DelAfterDone, WriteMetaJson, AppendUrlParams, ConcurrentDownload, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix,
|
BinaryMerge, DelAfterDone, WriteMetaJson, AppendUrlParams, ConcurrentDownload, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix,
|
||||||
|
@ -342,7 +363,7 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
LogLevel, UILanguage, UrlProcessorArgs, Keys, KeyTextFile, DecryptionBinaryPath, UseShakaPackager, MP4RealTimeDecryption,
|
LogLevel, UILanguage, UrlProcessorArgs, Keys, KeyTextFile, DecryptionBinaryPath, UseShakaPackager, MP4RealTimeDecryption,
|
||||||
MuxAfterDone,
|
MuxAfterDone,
|
||||||
LivePerformAsVod, LiveRealTimeMerge, LiveKeepSegments, LiveRecordLimit,
|
LivePerformAsVod, LiveRealTimeMerge, LiveKeepSegments, LiveRecordLimit,
|
||||||
MuxImports, VideoFilter, AudioFilter, SubtitleFilter
|
MuxImports, VideoFilter, AudioFilter, SubtitleFilter, MoreHelp
|
||||||
};
|
};
|
||||||
rootCommand.TreatUnmatchedTokensAsErrors = true;
|
rootCommand.TreatUnmatchedTokensAsErrors = true;
|
||||||
rootCommand.SetHandler(async (myOption) => await action(myOption), new MyOptionBinder());
|
rootCommand.SetHandler(async (myOption) => await action(myOption), new MyOptionBinder());
|
||||||
|
|
Loading…
Reference in New Issue