From 4579334a3fff6571b8114e0738a55c4a51e9019b Mon Sep 17 00:00:00 2001 From: nilaoda Date: Wed, 28 Sep 2022 10:43:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E4=B8=8B=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=87=8D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ src/N_m3u8DL-RE.Parser/StreamExtractor.cs | 18 +++++++++++++++++- src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4b0547a..707da68 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,9 @@ # Mono auto generated files mono_crash.* +# Properties +Properties/ + # Build results [Dd]ebug/ [Dd]ebugPublic/ diff --git a/src/N_m3u8DL-RE.Parser/StreamExtractor.cs b/src/N_m3u8DL-RE.Parser/StreamExtractor.cs index b487a49..06e7aa9 100644 --- a/src/N_m3u8DL-RE.Parser/StreamExtractor.cs +++ b/src/N_m3u8DL-RE.Parser/StreamExtractor.cs @@ -6,6 +6,7 @@ using N_m3u8DL_RE.Parser.Constants; using N_m3u8DL_RE.Parser.Extractor; using N_m3u8DL_RE.Common.Util; using N_m3u8DL_RE.Common.Enum; +using Spectre.Console; namespace N_m3u8DL_RE.Parser { @@ -114,7 +115,22 @@ namespace N_m3u8DL_RE.Parser try { 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 { diff --git a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs index fae7c67..691e80c 100644 --- a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs +++ b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs @@ -433,7 +433,7 @@ namespace N_m3u8DL_RE.CommandLine 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, BinaryMerge, DelAfterDone, WriteMetaJson, AppendUrlParams, ConcurrentDownload, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix,