From fdc38969bda0f25d815c6e7db3dc42e1ea5f10b3 Mon Sep 17 00:00:00 2001 From: N00MKRAD Date: Wed, 6 Jan 2021 18:02:14 +0100 Subject: [PATCH] AutoEncode "Delete Frames Once Encoded" works again No longer deletes frames that are still needed (for dupes) --- Code/Main/AutoEncode.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Code/Main/AutoEncode.cs b/Code/Main/AutoEncode.cs index a479ec0..51f6edb 100644 --- a/Code/Main/AutoEncode.cs +++ b/Code/Main/AutoEncode.cs @@ -94,8 +94,9 @@ namespace Flowframes.Main { foreach (int frame in frameLinesToEncode) { - // TODO: Make sure frames are no longer needed (e.g. for dupes) before deleting!! - continue; + // Make sure frames are no longer needed (e.g. for dupes) before deleting! + if(FrameIsStillNeeded(interpFramesLines[frame], frame)) + continue; string framePath = Path.Combine(interpFramesPath, interpFramesLines[frame]); File.WriteAllText(framePath, "THIS IS A DUMMY FILE - DO NOT DELETE ME"); // Overwrite to save space without breaking progress counter @@ -119,6 +120,16 @@ namespace Flowframes.Main await CreateVideo.ChunksToVideos(Interpolate.current.tempFolder, videoChunksFolder, Interpolate.current.outFilename); } + static bool FrameIsStillNeeded (string frameName, int frameIndex) + { + for(int i = frameIndex + 1; i < interpFramesLines.Length; i++) + { + if (interpFramesLines[i].Contains(frameName)) + return true; + } + return false; + } + public static bool HasWorkToDo () { if (Interpolate.canceled || interpFramesFolder == null) return false;