From e7dae90c9230e2ab4b3c079db92d47b927ecd98d Mon Sep 17 00:00:00 2001 From: N00MKRAD Date: Sun, 13 Dec 2020 23:44:23 +0100 Subject: [PATCH] Removed input file extension restriction, better err handling for frame extraction --- Code/Magick/MagickDedupe.cs | 6 +++++- Code/Main/Interpolate.cs | 11 +++++++++-- Code/Main/InterpolateUtils.cs | 8 ++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Code/Magick/MagickDedupe.cs b/Code/Magick/MagickDedupe.cs index 54a37bd..e11cd9d 100644 --- a/Code/Magick/MagickDedupe.cs +++ b/Code/Magick/MagickDedupe.cs @@ -23,9 +23,13 @@ namespace Flowframes.Magick public static async Task Run(string path, bool testRun = false, bool setStatus = true) { + if (path == null || !Directory.Exists(path) || Interpolate.canceled) + return; + currentMode = Mode.Auto; - Program.mainForm.SetStatus("Running frame de-duplication"); + if(setStatus) + Program.mainForm.SetStatus("Running frame de-duplication"); currentThreshold = Config.GetFloat("dedupThresh"); Logger.Log("Running accurate frame de-duplication..."); diff --git a/Code/Main/Interpolate.cs b/Code/Main/Interpolate.cs index a99dae8..d4bbe2f 100644 --- a/Code/Main/Interpolate.cs +++ b/Code/Main/Interpolate.cs @@ -148,8 +148,15 @@ namespace Flowframes { if (canceled) return; - if (!Directory.Exists(currentFramesPath) || currentInputFrameCount <= 0 || IOUtils.GetAmountOfFiles(currentFramesPath, false, "*.png") < 2) - Cancel("Extracted frames folder is empty!"); + int extractedFrames = IOUtils.GetAmountOfFiles(currentFramesPath, false, "*.png"); + if (!Directory.Exists(currentFramesPath) || currentInputFrameCount <= 0 || extractedFrames < 2) + { + if(extractedFrames == 1) + Cancel("Only a single frame was extracted from your input file!\n\nPossibly your input is an image, not a video?"); + else + Cancel("Frame extraction failed!\n\nYour input file might be incompatible."); + } + if (Config.GetInt("dedupMode") == 1) await MagickDedupe.Run(currentFramesPath); diff --git a/Code/Main/InterpolateUtils.cs b/Code/Main/InterpolateUtils.cs index 1197c98..d3c48f3 100644 --- a/Code/Main/InterpolateUtils.cs +++ b/Code/Main/InterpolateUtils.cs @@ -239,10 +239,10 @@ namespace Flowframes.Main { if (videoPath == null || !IOUtils.IsFileValid(videoPath)) return false; - string ext = Path.GetExtension(videoPath).ToLower(); - if (Formats.supported.Contains(ext)) - return true; - return false; + // string ext = Path.GetExtension(videoPath).ToLower(); + // if (!Formats.supported.Contains(ext)) + // return false; + return true; } public static string GetExt(i.OutMode format)