增加重试次数设置 #6
This commit is contained in:
parent
d9cc09dff8
commit
68e8e1d739
|
@ -39,6 +39,7 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
public static string cmd_subOnly { get => GetText("cmd_subOnly"); }
|
public static string cmd_subOnly { get => GetText("cmd_subOnly"); }
|
||||||
public static string cmd_subtitleFix { get => GetText("cmd_subtitleFix"); }
|
public static string cmd_subtitleFix { get => GetText("cmd_subtitleFix"); }
|
||||||
public static string cmd_threadCount { get => GetText("cmd_threadCount"); }
|
public static string cmd_threadCount { get => GetText("cmd_threadCount"); }
|
||||||
|
public static string cmd_downloadRetryCount { get => GetText("cmd_downloadRetryCount"); }
|
||||||
public static string cmd_tmpDir { get => GetText("cmd_tmpDir"); }
|
public static string cmd_tmpDir { get => GetText("cmd_tmpDir"); }
|
||||||
public static string cmd_uiLanguage { get => GetText("cmd_uiLanguage"); }
|
public static string cmd_uiLanguage { get => GetText("cmd_uiLanguage"); }
|
||||||
public static string cmd_urlProcessorArgs { get => GetText("cmd_urlProcessorArgs"); }
|
public static string cmd_urlProcessorArgs { get => GetText("cmd_urlProcessorArgs"); }
|
||||||
|
|
|
@ -76,6 +76,12 @@ namespace N_m3u8DL_RE.Common.Resource
|
||||||
zhTW: "檢測實際下載的分片數量和預期數量是否匹配",
|
zhTW: "檢測實際下載的分片數量和預期數量是否匹配",
|
||||||
enUS: "Check if the actual number of segments downloaded matches the expected number"
|
enUS: "Check if the actual number of segments downloaded matches the expected number"
|
||||||
),
|
),
|
||||||
|
["cmd_downloadRetryCount"] = new TextContainer
|
||||||
|
(
|
||||||
|
zhCN: "每个分片下载异常时的重试次数",
|
||||||
|
zhTW: "每個分片下載異常時的重試次數",
|
||||||
|
enUS: "The number of retries when download segment error"
|
||||||
|
),
|
||||||
["cmd_decryptionBinaryPath"] = new TextContainer
|
["cmd_decryptionBinaryPath"] = new TextContainer
|
||||||
(
|
(
|
||||||
zhCN: "MP4解密所用工具的全路径, 例如 C:\\Tools\\mp4decrypt.exe",
|
zhCN: "MP4解密所用工具的全路径, 例如 C:\\Tools\\mp4decrypt.exe",
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
private readonly static Option<bool> AutoSelect = new(new string[] { "--auto-select" }, description: ResString.cmd_autoSelect, getDefaultValue: () => false);
|
private readonly static Option<bool> AutoSelect = new(new string[] { "--auto-select" }, description: ResString.cmd_autoSelect, getDefaultValue: () => false);
|
||||||
private readonly static Option<bool> SubOnly = new(new string[] { "--sub-only" }, description: ResString.cmd_subOnly, getDefaultValue: () => false);
|
private readonly static Option<bool> SubOnly = new(new string[] { "--sub-only" }, description: ResString.cmd_subOnly, getDefaultValue: () => false);
|
||||||
private readonly static Option<int> ThreadCount = new(new string[] { "--thread-count" }, description: ResString.cmd_threadCount, getDefaultValue: () => 8);
|
private readonly static Option<int> ThreadCount = new(new string[] { "--thread-count" }, description: ResString.cmd_threadCount, getDefaultValue: () => 8);
|
||||||
|
private readonly static Option<int> DownloadRetryCount = new(new string[] { "--download-retry-count" }, description: ResString.cmd_downloadRetryCount, getDefaultValue: () => 3);
|
||||||
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> 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);
|
||||||
|
@ -71,6 +72,7 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
DecryptionBinaryPath = bindingContext.ParseResult.GetValueForOption(DecryptionBinaryPath),
|
DecryptionBinaryPath = bindingContext.ParseResult.GetValueForOption(DecryptionBinaryPath),
|
||||||
FFmpegBinaryPath = bindingContext.ParseResult.GetValueForOption(FFmpegBinaryPath),
|
FFmpegBinaryPath = bindingContext.ParseResult.GetValueForOption(FFmpegBinaryPath),
|
||||||
KeyTextFile = bindingContext.ParseResult.GetValueForOption(KeyTextFile),
|
KeyTextFile = bindingContext.ParseResult.GetValueForOption(KeyTextFile),
|
||||||
|
DownloadRetryCount = bindingContext.ParseResult.GetValueForOption(DownloadRetryCount),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,9 +91,9 @@ 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) 20220817")
|
var rootCommand = new RootCommand("N_m3u8DL-RE (Beta version) 20220818")
|
||||||
{
|
{
|
||||||
Input, TmpDir, SaveDir, SaveName, ThreadCount, AutoSelect, SkipMerge, SkipDownload, CheckSegmentsCount,
|
Input, TmpDir, SaveDir, SaveName, ThreadCount, DownloadRetryCount, AutoSelect, SkipMerge, SkipDownload, CheckSegmentsCount,
|
||||||
BinaryMerge, DelAfterDone, WriteMetaJson, AppendUrlParams, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix,
|
BinaryMerge, DelAfterDone, WriteMetaJson, AppendUrlParams, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix,
|
||||||
FFmpegBinaryPath,
|
FFmpegBinaryPath,
|
||||||
LogLevel, UILanguage, UrlProcessorArgs, Keys, KeyTextFile, DecryptionBinaryPath, UseShakaPackager, MP4RealTimeDecryption
|
LogLevel, UILanguage, UrlProcessorArgs, Keys, KeyTextFile, DecryptionBinaryPath, UseShakaPackager, MP4RealTimeDecryption
|
||||||
|
|
|
@ -42,6 +42,10 @@ namespace N_m3u8DL_RE.CommandLine
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ThreadCount { get; set; }
|
public int ThreadCount { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// See: <see cref="CommandInvoker.DownloadRetryCount"/>.
|
||||||
|
/// </summary>
|
||||||
|
public int DownloadRetryCount { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// See: <see cref="CommandInvoker.SkipMerge"/>.
|
/// See: <see cref="CommandInvoker.SkipMerge"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SkipMerge { get; set; }
|
public bool SkipMerge { get; set; }
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace N_m3u8DL_RE.Config
|
||||||
DecryptionBinaryPath = option.DecryptionBinaryPath;
|
DecryptionBinaryPath = option.DecryptionBinaryPath;
|
||||||
FFmpegBinaryPath = option.FFmpegBinaryPath;
|
FFmpegBinaryPath = option.FFmpegBinaryPath;
|
||||||
KeyTextFile = option.KeyTextFile;
|
KeyTextFile = option.KeyTextFile;
|
||||||
|
DownloadRetryCount = option.DownloadRetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -55,6 +56,10 @@ namespace N_m3u8DL_RE.Config
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ThreadCount { get; set; } = 8;
|
public int ThreadCount { get; set; } = 8;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 每个分片的重试次数
|
||||||
|
/// </summary>
|
||||||
|
public int DownloadRetryCount { get; set; } = 3;
|
||||||
|
/// <summary>
|
||||||
/// 跳过合并
|
/// 跳过合并
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SkipMerge { get; set; } = false;
|
public bool SkipMerge { get; set; } = false;
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace N_m3u8DL_RE.Downloader
|
||||||
public async Task<DownloadResult?> DownloadSegmentAsync(MediaSegment segment, string savePath, Dictionary<string, string>? headers = null)
|
public async Task<DownloadResult?> DownloadSegmentAsync(MediaSegment segment, string savePath, Dictionary<string, string>? headers = null)
|
||||||
{
|
{
|
||||||
var url = segment.Url;
|
var url = segment.Url;
|
||||||
var dResult = await DownClipAsync(url, savePath, segment.StartRange, segment.StopRange, headers);
|
var dResult = await DownClipAsync(url, savePath, segment.StartRange, segment.StopRange, headers, DownloaderConfig.DownloadRetryCount);
|
||||||
if (dResult != null && dResult.Success && segment.EncryptInfo != null)
|
if (dResult != null && dResult.Success && segment.EncryptInfo != null)
|
||||||
{
|
{
|
||||||
if (segment.EncryptInfo.Method == EncryptMethod.AES_128)
|
if (segment.EncryptInfo.Method == EncryptMethod.AES_128)
|
||||||
|
|
Loading…
Reference in New Issue