支持不写入日期信息
This commit is contained in:
parent
21e3970a50
commit
26c74f4392
|
@ -49,6 +49,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
public static string cmd_saveName { get => GetText("cmd_saveName"); }
|
public static string cmd_saveName { get => GetText("cmd_saveName"); }
|
||||||
public static string cmd_savePattern { get => GetText("cmd_savePattern"); }
|
public static string cmd_savePattern { get => GetText("cmd_savePattern"); }
|
||||||
public static string cmd_skipDownload { get => GetText("cmd_skipDownload"); }
|
public static string cmd_skipDownload { get => GetText("cmd_skipDownload"); }
|
||||||
|
public static string cmd_noDateInfo { get => GetText("cmd_noDateInfo"); }
|
||||||
public static string cmd_skipMerge { get => GetText("cmd_skipMerge"); }
|
public static string cmd_skipMerge { get => GetText("cmd_skipMerge"); }
|
||||||
public static string cmd_subFormat { get => GetText("cmd_subFormat"); }
|
public static string cmd_subFormat { get => GetText("cmd_subFormat"); }
|
||||||
public static string cmd_subOnly { get => GetText("cmd_subOnly"); }
|
public static string cmd_subOnly { get => GetText("cmd_subOnly"); }
|
||||||
|
|
|
@ -64,6 +64,12 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
zhTW: "設置BaseURL",
|
zhTW: "設置BaseURL",
|
||||||
enUS: "Set BaseURL"
|
enUS: "Set BaseURL"
|
||||||
),
|
),
|
||||||
|
["cmd_noDateInfo"] = new TextContainer
|
||||||
|
(
|
||||||
|
zhCN: "混流时不写入日期信息",
|
||||||
|
zhTW: "混流時不寫入日期訊息",
|
||||||
|
enUS: "Date information is not written during muxing"
|
||||||
|
),
|
||||||
["cmd_appendUrlParams"] = new TextContainer
|
["cmd_appendUrlParams"] = new TextContainer
|
||||||
(
|
(
|
||||||
zhCN: "将输入Url的Params添加至分片, 对某些网站很有用, 例如 kakao.com",
|
zhCN: "将输入Url的Params添加至分片, 对某些网站很有用, 例如 kakao.com",
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
{
|
{
|
||||||
internal partial class CommandInvoker
|
internal partial class CommandInvoker
|
||||||
{
|
{
|
||||||
public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20221031";
|
public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20221101";
|
||||||
|
|
||||||
[GeneratedRegex("((best|worst)\\d*|all)")]
|
[GeneratedRegex("((best|worst)\\d*|all)")]
|
||||||
private static partial Regex ForStrRegex();
|
private static partial Regex ForStrRegex();
|
||||||
|
@ -41,6 +41,7 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
private readonly static Option<int> DownloadRetryCount = new(new string[] { "--download-retry-count" }, description: ResString.cmd_downloadRetryCount, getDefaultValue: () => 3) { ArgumentHelpName = "number" };
|
private readonly static Option<int> DownloadRetryCount = new(new string[] { "--download-retry-count" }, description: ResString.cmd_downloadRetryCount, getDefaultValue: () => 3) { ArgumentHelpName = "number" };
|
||||||
private readonly static Option<bool> SkipMerge = new(new string[] { "--skip-merge" }, description: ResString.cmd_skipMerge, getDefaultValue: () => false);
|
private readonly static Option<bool> SkipMerge = new(new string[] { "--skip-merge" }, description: ResString.cmd_skipMerge, getDefaultValue: () => false);
|
||||||
private readonly static Option<bool> SkipDownload = new(new string[] { "--skip-download" }, description: ResString.cmd_skipDownload, getDefaultValue: () => false);
|
private readonly static Option<bool> SkipDownload = new(new string[] { "--skip-download" }, description: ResString.cmd_skipDownload, getDefaultValue: () => false);
|
||||||
|
private readonly static Option<bool> NoDateInfo = new(new string[] { "--no-date-info" }, description: ResString.cmd_noDateInfo, getDefaultValue: () => false);
|
||||||
private readonly static Option<bool> BinaryMerge = new(new string[] { "--binary-merge" }, description: ResString.cmd_binaryMerge, getDefaultValue: () => false);
|
private readonly static Option<bool> BinaryMerge = new(new string[] { "--binary-merge" }, description: ResString.cmd_binaryMerge, getDefaultValue: () => false);
|
||||||
private readonly static Option<bool> DelAfterDone = new(new string[] { "--del-after-done" }, description: ResString.cmd_delAfterDone, getDefaultValue: () => true);
|
private readonly static Option<bool> DelAfterDone = new(new string[] { "--del-after-done" }, description: ResString.cmd_delAfterDone, getDefaultValue: () => true);
|
||||||
private readonly static Option<bool> AutoSubtitleFix = new(new string[] { "--auto-subtitle-fix" }, description: ResString.cmd_subtitleFix, getDefaultValue: () => true);
|
private readonly static Option<bool> AutoSubtitleFix = new(new string[] { "--auto-subtitle-fix" }, description: ResString.cmd_subtitleFix, getDefaultValue: () => true);
|
||||||
|
@ -379,6 +380,7 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
UseSystemProxy = bindingContext.ParseResult.GetValueForOption(UseSystemProxy),
|
UseSystemProxy = bindingContext.ParseResult.GetValueForOption(UseSystemProxy),
|
||||||
CustomProxy = bindingContext.ParseResult.GetValueForOption(CustomProxy),
|
CustomProxy = bindingContext.ParseResult.GetValueForOption(CustomProxy),
|
||||||
LiveWaitTime = bindingContext.ParseResult.GetValueForOption(LiveWaitTime),
|
LiveWaitTime = bindingContext.ParseResult.GetValueForOption(LiveWaitTime),
|
||||||
|
NoDateInfo = bindingContext.ParseResult.GetValueForOption(NoDateInfo),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (bindingContext.ParseResult.HasOption(CustomHLSMethod)) option.CustomHLSMethod = bindingContext.ParseResult.GetValueForOption(CustomHLSMethod);
|
if (bindingContext.ParseResult.HasOption(CustomHLSMethod)) option.CustomHLSMethod = bindingContext.ParseResult.GetValueForOption(CustomHLSMethod);
|
||||||
|
@ -439,7 +441,7 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
var rootCommand = new RootCommand(VERSION_INFO)
|
var rootCommand = new RootCommand(VERSION_INFO)
|
||||||
{
|
{
|
||||||
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, NoDateInfo, WriteMetaJson, AppendUrlParams, ConcurrentDownload, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix,
|
||||||
FFmpegBinaryPath,
|
FFmpegBinaryPath,
|
||||||
LogLevel, UILanguage, UrlProcessorArgs, Keys, KeyTextFile, DecryptionBinaryPath, UseShakaPackager, MP4RealTimeDecryption,
|
LogLevel, UILanguage, UrlProcessorArgs, Keys, KeyTextFile, DecryptionBinaryPath, UseShakaPackager, MP4RealTimeDecryption,
|
||||||
MuxAfterDone,
|
MuxAfterDone,
|
||||||
|
|
|
@ -37,6 +37,10 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LogLevel LogLevel { get; set; }
|
public LogLevel LogLevel { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// See: <see cref="CommandInvoker.NoDateInfo"/>.
|
||||||
|
/// </summary>
|
||||||
|
public bool NoDateInfo { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// See: <see cref="CommandInvoker.AutoSelect"/>.
|
/// See: <see cref="CommandInvoker.AutoSelect"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoSelect { get; set; }
|
public bool AutoSelect { get; set; }
|
||||||
|
|
|
@ -501,7 +501,7 @@ namespace N_m3u8DL_RE.DownloadManager
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mergeSuccess = MergeUtil.MergeByFFmpeg(DownloaderConfig.MyOptions.FFmpegBinaryPath!, files, Path.ChangeExtension(ffOut, null), ext, useAACFilter);
|
mergeSuccess = MergeUtil.MergeByFFmpeg(DownloaderConfig.MyOptions.FFmpegBinaryPath!, files, Path.ChangeExtension(ffOut, null), ext, useAACFilter, writeDate: !DownloaderConfig.MyOptions.NoDateInfo);
|
||||||
if (mergeSuccess) output = ffOut;
|
if (mergeSuccess) output = ffOut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,7 +625,7 @@ namespace N_m3u8DL_RE.DownloadManager
|
||||||
Logger.WarnMarkUp($"Muxing to [grey]{outName.EscapeMarkup()}{ext}[/]");
|
Logger.WarnMarkUp($"Muxing to [grey]{outName.EscapeMarkup()}{ext}[/]");
|
||||||
var result = false;
|
var result = false;
|
||||||
if (DownloaderConfig.MyOptions.UseMkvmerge) result = MergeUtil.MuxInputsByMkvmerge(DownloaderConfig.MyOptions.MkvmergeBinaryPath!, OutputFiles.ToArray(), outPath);
|
if (DownloaderConfig.MyOptions.UseMkvmerge) result = MergeUtil.MuxInputsByMkvmerge(DownloaderConfig.MyOptions.MkvmergeBinaryPath!, OutputFiles.ToArray(), outPath);
|
||||||
else result = MergeUtil.MuxInputsByFFmpeg(DownloaderConfig.MyOptions.FFmpegBinaryPath!, OutputFiles.ToArray(), outPath, DownloaderConfig.MyOptions.MuxToMp4);
|
else result = MergeUtil.MuxInputsByFFmpeg(DownloaderConfig.MyOptions.FFmpegBinaryPath!, OutputFiles.ToArray(), outPath, DownloaderConfig.MyOptions.MuxToMp4, !DownloaderConfig.MyOptions.NoDateInfo);
|
||||||
//完成后删除各轨道文件
|
//完成后删除各轨道文件
|
||||||
if (result && !DownloaderConfig.MyOptions.MuxKeepFiles)
|
if (result && !DownloaderConfig.MyOptions.MuxKeepFiles)
|
||||||
{
|
{
|
||||||
|
|
|
@ -710,7 +710,7 @@ namespace N_m3u8DL_RE.DownloadManager
|
||||||
Logger.WarnMarkUp($"Muxing to [grey]{outName.EscapeMarkup()}{ext}[/]");
|
Logger.WarnMarkUp($"Muxing to [grey]{outName.EscapeMarkup()}{ext}[/]");
|
||||||
var result = false;
|
var result = false;
|
||||||
if (DownloaderConfig.MyOptions.UseMkvmerge) result = MergeUtil.MuxInputsByMkvmerge(DownloaderConfig.MyOptions.MkvmergeBinaryPath!, OutputFiles.ToArray(), outPath);
|
if (DownloaderConfig.MyOptions.UseMkvmerge) result = MergeUtil.MuxInputsByMkvmerge(DownloaderConfig.MyOptions.MkvmergeBinaryPath!, OutputFiles.ToArray(), outPath);
|
||||||
else result = MergeUtil.MuxInputsByFFmpeg(DownloaderConfig.MyOptions.FFmpegBinaryPath!, OutputFiles.ToArray(), outPath, DownloaderConfig.MyOptions.MuxToMp4);
|
else result = MergeUtil.MuxInputsByFFmpeg(DownloaderConfig.MyOptions.FFmpegBinaryPath!, OutputFiles.ToArray(), outPath, DownloaderConfig.MyOptions.MuxToMp4, !DownloaderConfig.MyOptions.NoDateInfo);
|
||||||
//完成后删除各轨道文件
|
//完成后删除各轨道文件
|
||||||
if (result && !DownloaderConfig.MyOptions.MuxKeepFiles)
|
if (result && !DownloaderConfig.MyOptions.MuxKeepFiles)
|
||||||
{
|
{
|
||||||
|
|
|
@ -175,7 +175,7 @@ namespace N_m3u8DL_RE.Util
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool MuxInputsByFFmpeg(string binary, OutputFile[] files, string outputPath, bool mp4)
|
public static bool MuxInputsByFFmpeg(string binary, OutputFile[] files, string outputPath, bool mp4, bool dateinfo)
|
||||||
{
|
{
|
||||||
var ext = mp4 ? "mp4" : "mkv";
|
var ext = mp4 ? "mp4" : "mkv";
|
||||||
string dateString = DateTime.Now.ToString("o");
|
string dateString = DateTime.Now.ToString("o");
|
||||||
|
@ -223,7 +223,8 @@ namespace N_m3u8DL_RE.Util
|
||||||
streamIndex++;
|
streamIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
command.Append($" -metadata date=\"{dateString}\" -ignore_unknown -copy_unknown ");
|
if(dateinfo) command.Append($" -metadata date=\"{dateString}\" ");
|
||||||
|
command.Append($" -ignore_unknown -copy_unknown ");
|
||||||
command.Append($" \"{outputPath}.{ext}\"");
|
command.Append($" \"{outputPath}.{ext}\"");
|
||||||
|
|
||||||
InvokeFFmpeg(binary, command.ToString(), Environment.CurrentDirectory);
|
InvokeFFmpeg(binary, command.ToString(), Environment.CurrentDirectory);
|
||||||
|
|
Loading…
Reference in New Issue