Fixed temp folder not deleting, attempt at fixing pkg download

This commit is contained in:
N00MKRAD
2020-12-03 21:02:50 +01:00
parent 0fb7b2cca3
commit 896e656e03
3 changed files with 14 additions and 6 deletions

View File

@@ -36,15 +36,16 @@ namespace Flowframes.IO
public static async Task DownloadAndInstall(string filename, bool showDialog = true) public static async Task DownloadAndInstall(string filename, bool showDialog = true)
{ {
string savePath = Path.Combine(Paths.GetPkgPath(), filename); string savePath = Path.Combine(Paths.GetPkgPath(), filename);
string url = $"https://dl.nmkd.de/flowframes/pkgs/{filename}"; string url = $"http://dl.nmkd.de/flowframes/pkgs/{filename}";
Logger.Log($"[PkgInstaller] Downloading {url}", true); Logger.Log($"[PkgInstaller] Downloading {url}", true);
var client = new WebClient(); var client = new WebClient();
//client.Proxy = WebRequest.DefaultWebProxy; client.Proxy = WebRequest.DefaultWebProxy;
Print($"Downloading {filename}..."); Print($"Downloading {filename}...");
sw.Restart(); sw.Restart();
client.DownloadProgressChanged += (sender, args) => client.DownloadProgressChanged += (sender, args) =>
{ {
if (sw.ElapsedMilliseconds > 200) if (sw.ElapsedMilliseconds > 250)
{ {
sw.Restart(); sw.Restart();
Print($"Downloading {filename}... {args.ProgressPercentage}%", true); Print($"Downloading {filename}... {args.ProgressPercentage}%", true);
@@ -52,9 +53,13 @@ namespace Flowframes.IO
}; };
client.DownloadFileCompleted += (sender, args) => client.DownloadFileCompleted += (sender, args) =>
{ {
if (args.Error != null)
Print("Download failed: " + args.Error.Message);
Print($"Downloading {filename}... 100%", true); Print($"Downloading {filename}... 100%", true);
}; };
await client.DownloadFileTaskAsync(new Uri(url), savePath); await client.DownloadFileTaskAsync(new Uri(url), savePath);
try try
{ {
if (Path.GetExtension(filename).ToLower() == ".7z") // Only run extractor if it's a 7z archive if (Path.GetExtension(filename).ToLower() == ".7z") // Only run extractor if it's a 7z archive

View File

@@ -144,7 +144,7 @@ namespace Flowframes
public static async Task PostProcessFrames (bool sbsMode = false) public static async Task PostProcessFrames (bool sbsMode = false)
{ {
bool firstFrameFix = (!sbsMode && lastAi.aiName == Networks.rifeCuda.aiName) || (sbsMode && InterpolateSteps.currentAi.aiName == Networks.rifeCuda.aiName); bool firstFrameFix = (!sbsMode && lastAi.aiName == Networks.rifeCuda.aiName) || (sbsMode && InterpolateSteps.currentAi.aiName == Networks.rifeCuda.aiName);
//firstFrameFix = false; // TODO: Remove firstframefix if new rife code works firstFrameFix = false; // TODO: Remove firstframefix if new rife code works
if (!Directory.Exists(currentFramesPath) || IOUtils.GetAmountOfFiles(currentFramesPath, false, "*.png") <= 0) if (!Directory.Exists(currentFramesPath) || IOUtils.GetAmountOfFiles(currentFramesPath, false, "*.png") <= 0)
{ {
@@ -185,7 +185,7 @@ namespace Flowframes
{ {
currentlyUsingAutoEnc = IOUtils.GetAmountOfFiles(currentFramesPath, false) * lastInterpFactor >= (AutoEncode.chunkSize + AutoEncode.safetyBufferFrames) * 1.2f; currentlyUsingAutoEnc = IOUtils.GetAmountOfFiles(currentFramesPath, false) * lastInterpFactor >= (AutoEncode.chunkSize + AutoEncode.safetyBufferFrames) * 1.2f;
//Logger.Log("Using autoenc if there's more than " + (AutoEncode.chunkSize + AutoEncode.safetyBufferFrames) * 1.2f + " input frames, got " + IOUtils.GetAmountOfFiles(currentFramesPath, false) * lastInterpFactor); //Logger.Log("Using autoenc if there's more than " + (AutoEncode.chunkSize + AutoEncode.safetyBufferFrames) * 1.2f + " input frames, got " + IOUtils.GetAmountOfFiles(currentFramesPath, false) * lastInterpFactor);
currentlyUsingAutoEnc = false; //currentlyUsingAutoEnc = false;
Directory.CreateDirectory(outpath); Directory.CreateDirectory(outpath);
@@ -241,7 +241,7 @@ namespace Flowframes
canceled = true; canceled = true;
Program.mainForm.SetStatus("Canceled."); Program.mainForm.SetStatus("Canceled.");
Program.mainForm.SetProgress(0); Program.mainForm.SetProgress(0);
if (Config.GetInt("processingMode") == 1 && !Config.GetBool("keepTempFolder")) if (Config.GetInt("processingMode") == 0 && !Config.GetBool("keepTempFolder"))
IOUtils.TryDeleteIfExists(currentTempDir); IOUtils.TryDeleteIfExists(currentTempDir);
Program.mainForm.SetWorking(false); Program.mainForm.SetWorking(false);
Program.mainForm.SetTab("interpolation"); Program.mainForm.SetTab("interpolation");

View File

@@ -76,7 +76,10 @@ namespace Flowframes.OS
string sysPyVer = GetSysPyVersion(); string sysPyVer = GetSysPyVersion();
if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.ToLower().Contains("not found") && sysPyVer.Length <= 35) if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.ToLower().Contains("not found") && sysPyVer.Length <= 35)
{
isInstalled = true; isInstalled = true;
Logger.Log("Using Python installation: " + sysPyVer, false, true);
}
hasCheckedSysPy = true; hasCheckedSysPy = true;
sysPyInstalled = isInstalled; sysPyInstalled = isInstalled;