Skip to content

Commit

Permalink
限定ffmpeg依赖从R2走
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Jul 6, 2024
1 parent 9c83246 commit ebf5933
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Core/Tools/ProgramUpdates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private static void ReplaceUpdateFfmpe(string url)
{
string ffmpegPath = "./plugins/ffmpeg/ffmpeg.exe";
string ffmpegUpdatePath = Core.Config.Core_RunConfig._TemporaryFileDirectory + "update_ffmpeg.exe";
if (DownloadFileAsync(url, ffmpegUpdatePath))
if (DownloadFileAsync(url, ffmpegUpdatePath,true))
{
if (File.Exists(ffmpegUpdatePath))
{
Expand All @@ -340,6 +340,10 @@ private static void ReplaceUpdateFfmpe(string url)
Log.Info(nameof(ReplaceUpdateFfmpe), "检查并更新ffmpeg依赖完成");
}
}
else
{
Log.Warn(nameof(ReplaceUpdateFfmpe), "尝试检查并更新ffmpeg依赖时,无法连接R2服务器,更新失败");
}
}
catch (Exception ex)
{
Expand Down Expand Up @@ -475,7 +479,7 @@ public static string Get(string URL)
return str;
}

public static bool DownloadFileAsync(string url, string outputPath)
public static bool DownloadFileAsync(string url, string outputPath, bool restrictedPrimaryServer = false)
{
int error_count = 0;
while (true)
Expand All @@ -492,6 +496,11 @@ public static bool DownloadFileAsync(string url, string outputPath)
}
else
{
if(restrictedPrimaryServer)
{
Log.Info(nameof(Update_UpdateProgram),$"出现网络错误,MainOnly");
return false;
}
FileDownloadAddress = MainDomainName + url;
}
try
Expand Down

0 comments on commit ebf5933

Please sign in to comment.