diff --git a/Code/IO/IOUtils.cs b/Code/IO/IOUtils.cs index 6cb4d10..2418b8e 100644 --- a/Code/IO/IOUtils.cs +++ b/Code/IO/IOUtils.cs @@ -99,7 +99,7 @@ namespace Flowframes.IO return true; } - public static void Copy(string sourceDirectoryName, string targetDirectoryName, bool move = false) + public static void CopyDir(string sourceDirectoryName, string targetDirectoryName, bool move = false) { Directory.CreateDirectory(targetDirectoryName); DirectoryInfo source = new DirectoryInfo(sourceDirectoryName); @@ -195,7 +195,7 @@ namespace Flowframes.IO } } - static bool TryCopy(string source, string target, bool overwrite = true) + static bool TryCopy(string source, string target, bool overwrite = true, bool showLog = false) { try { @@ -203,14 +203,14 @@ namespace Flowframes.IO } catch (Exception e) { - Logger.Log($"Failed to move '{source}' to '{target}' (Overwrite: {overwrite}): {e.Message}"); + Logger.Log($"Failed to move '{source}' to '{target}' (Overwrite: {overwrite}): {e.Message}, !showLog"); return false; } return true; } - public static bool TryMove(string source, string target, bool overwrite = true) + public static bool TryMove(string source, string target, bool overwrite = true, bool showLog = false) { try { @@ -221,7 +221,7 @@ namespace Flowframes.IO } catch (Exception e) { - Logger.Log($"Failed to move '{source}' to '{target}' (Overwrite: {overwrite}): {e.Message}"); + Logger.Log($"Failed to move '{source}' to '{target}' (Overwrite: {overwrite}): {e.Message}", !showLog); return false; } diff --git a/Code/Main/Interpolate.cs b/Code/Main/Interpolate.cs index c8e3594..0179edb 100644 --- a/Code/Main/Interpolate.cs +++ b/Code/Main/Interpolate.cs @@ -223,6 +223,7 @@ namespace Flowframes } else { + Logger.Log("Deleting temp folder because current.stepByStep = " + current.stepByStep); IOUtils.TryDeleteIfExists(current.tempFolder); } } diff --git a/Code/Main/InterpolateSteps.cs b/Code/Main/InterpolateSteps.cs index 15d97fa..e4dde50 100644 --- a/Code/Main/InterpolateSteps.cs +++ b/Code/Main/InterpolateSteps.cs @@ -24,7 +24,7 @@ namespace Flowframes.Main Program.mainForm.SetWorking(true); current = Program.mainForm.GetCurrentSettings(); current.RefreshAlpha(); - current.stepByStep = false; + current.stepByStep = true; if (!InterpolateUtils.InputIsValid(current.inPath, current.outPath, current.outFps, current.interpFactor, current.outMode)) return; // General input checks diff --git a/Code/OS/AiProcess.cs b/Code/OS/AiProcess.cs index 518df1d..7a3ba04 100644 --- a/Code/OS/AiProcess.cs +++ b/Code/OS/AiProcess.cs @@ -203,6 +203,9 @@ namespace Flowframes string uhdStr = await InterpolateUtils.UseUHD() ? "-u" : ""; string ttaStr = Config.GetBool("rifeNcnnUseTta", false) ? "-x" : ""; + string oldMdlName = mdl; + mdl = RifeNcnn2Workaround(mdl); // TODO: REMOVE ONCE NIHUI HAS GOTTEN RID OF THE SHITTY HARDCODED VERSION CHECK + rifeNcnn.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {PkgUtils.GetPkgFolder(Packages.rifeNcnn).Wrap()} & rife-ncnn-vulkan.exe " + $" -v -i {inPath.Wrap()} -o {outPath.Wrap()} -m {mdl.ToLower()} {ttaStr} {uhdStr} -g {Config.Get("ncnnGpus")} -f {GetNcnnPattern()} -j {GetNcnnThreads()}"; @@ -223,6 +226,7 @@ namespace Flowframes } while (!rifeNcnn.HasExited) await Task.Delay(1); + RifeNcnn2Workaround(oldMdlName, true); } public static async Task RunDainNcnn(string framesPath, string outPath, float factor, string mdl, int tilesize) @@ -363,5 +367,27 @@ namespace Flowframes return $"4:{progThreadsStr}:4"; ; } + + static string RifeNcnn2Workaround (string modelName, bool reset = false) + { + if (modelName != "RIFE20") return modelName; + string validMdlName = "rife-v2"; + string rifeFolderPath = Path.Combine(Paths.GetPkgPath(), Path.GetFileNameWithoutExtension(Packages.rifeNcnn.fileName)); + string modelFolderPath = Path.Combine(rifeFolderPath, modelName); + string fixedModelFolderPath = Path.Combine(rifeFolderPath, validMdlName); + + if (!reset) + { + IOUtils.TryDeleteIfExists(fixedModelFolderPath); + Directory.Move(modelFolderPath, fixedModelFolderPath); + } + else + { + IOUtils.TryDeleteIfExists(modelFolderPath); + Directory.Move(fixedModelFolderPath, modelFolderPath); + } + + return validMdlName; + } } }