Skip to content

Commit

Permalink
fixed crash when downloading ffmpeg due to zeranoe being offline
Browse files Browse the repository at this point in the history
  • Loading branch information
MilchRatchet committed Oct 3, 2020
1 parent 26d0a9a commit 367e998
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
32 changes: 28 additions & 4 deletions SubBox/Models/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace SubBox.Models
{
public class Downloader
{

public static void DownloadFiles()
{
try
Expand Down Expand Up @@ -66,10 +67,22 @@ public static void DownloadFiles()
}
};

client.DownloadFileAsync(new Uri("https://youtube-dl.org/downloads/latest/youtube-dl.exe"), "youtube-dl.exe");
try
{
client.DownloadFile(new Uri("https://youtube-dl.org/downloads/latest/youtube-dl.exe"), "youtube-dl.exe");
}
catch (Exception m)
{
Logger.Info("Failed downloading youtube-dl");

Logger.Info("Please open an issue on Github if this issue persists");

Logger.Error(m.Message);
}
}

if (!ffmpeg)
//ffmpeg is to be included in releases until a stable download option is found now that zeranoe is no more
/*if (!ffmpeg)
{
Logger.Info("ffmpeg.exe not found");
Expand Down Expand Up @@ -134,8 +147,19 @@ public static void DownloadFiles()
}
};
client.DownloadFileAsync(new Uri("https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.2.1-win64-static.zip"), "ffmpeg.zip");
}
try
{
client.DownloadFile(new Uri("https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip"), "ffmpeg.zip");
}
catch (Exception m)
{
Logger.Info("Failed downloading ffmpeg");
Logger.Info("Please open an issue on Github if this issue persists");
Logger.Error(m.Message);
}
}*/
}
catch (Exception e)
{
Expand Down
10 changes: 5 additions & 5 deletions SubBox/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

Logger.Info("SubBox Build v"+ BuildVersion + " - " + BuildTime.Day + "." + BuildTime.Month + "." + BuildTime.Year);

AppSettings.DownloadReady = false;

Downloader.DownloadFiles();

//load settings
try
{
Expand Down Expand Up @@ -143,12 +139,16 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

AppSettings.SetFirstUse();

AppSettings.DownloadReady = false;

Downloader.DownloadFiles();

if (AppSettings.LastRefresh.DayOfYear != DateTime.Now.DayOfYear || AppSettings.PicOfTheDayLink == "")
{
Downloader.GetPictureOfTheDay();
}

if (AppSettings.UpdateYDL)
if (AppSettings.UpdateYDL && AppSettings.DownloadReady)
{
string path = Directory.GetCurrentDirectory() + @"\youtube-dl.exe";

Expand Down

0 comments on commit 367e998

Please sign in to comment.