直播下刷新列表增加默认异常重试

This commit is contained in:
nilaoda 2022-09-28 10:43:18 +08:00
parent cca807b2c1
commit 4579334a3f
3 changed files with 21 additions and 2 deletions

3
.gitignore vendored
View File

@ -16,6 +16,9 @@
# Mono auto generated files # Mono auto generated files
mono_crash.* mono_crash.*
# Properties
Properties/
# Build results # Build results
[Dd]ebug/ [Dd]ebug/
[Dd]ebugPublic/ [Dd]ebugPublic/

View File

@ -6,6 +6,7 @@ using N_m3u8DL_RE.Parser.Constants;
using N_m3u8DL_RE.Parser.Extractor; using N_m3u8DL_RE.Parser.Extractor;
using N_m3u8DL_RE.Common.Util; using N_m3u8DL_RE.Common.Util;
using N_m3u8DL_RE.Common.Enum; using N_m3u8DL_RE.Common.Enum;
using Spectre.Console;
namespace N_m3u8DL_RE.Parser namespace N_m3u8DL_RE.Parser
{ {
@ -114,7 +115,22 @@ namespace N_m3u8DL_RE.Parser
try try
{ {
await semaphore.WaitAsync(); await semaphore.WaitAsync();
await extractor.RefreshPlayListAsync(streamSpecs); int retryCount = 3; //增加重试
reGet:
try
{
await extractor.RefreshPlayListAsync(streamSpecs);
}
catch (Exception ex)
{
if (retryCount-- > 0)
{
Logger.WarnMarkUp($"[grey]Refresh Exception: {ex.Message.EscapeMarkup()} retryCount: {retryCount}[/]");
await Task.Delay(300);
goto reGet;
}
else throw;
}
} }
finally finally
{ {

View File

@ -433,7 +433,7 @@ namespace N_m3u8DL_RE.CommandLine
Environment.Exit(0); Environment.Exit(0);
} }
var rootCommand = new RootCommand("N_m3u8DL-RE (Beta version) 20220927") var rootCommand = new RootCommand("N_m3u8DL-RE (Beta version) 20220928")
{ {
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,