From 3caa1ec6c20c75062ae8719e7eff08c367c8c166 Mon Sep 17 00:00:00 2001 From: n00mkrad Date: Wed, 29 Sep 2021 23:49:26 +0200 Subject: [PATCH] Delete invalid/incomplete chunks before resuming to avoid duplicate chunks --- Code/Main/AutoEncodeResume.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Code/Main/AutoEncodeResume.cs b/Code/Main/AutoEncodeResume.cs index 1eb5a9a..c295c09 100644 --- a/Code/Main/AutoEncodeResume.cs +++ b/Code/Main/AutoEncodeResume.cs @@ -92,14 +92,19 @@ namespace Flowframes.Main IoUtils.TryDeleteIfExists(inputFrameFullPath); } + string videoChunksFolder = Path.Combine(I.current.tempFolder, Paths.chunksDir); + + FileInfo[] invalidChunks = IoUtils.GetFileInfosSorted(videoChunksFolder, false, "????.*").Skip(encodedChunks).ToArray(); + + foreach (FileInfo chunk in invalidChunks) + chunk.Delete(); + int inputFramesLeft = IoUtils.GetAmountOfFiles(Path.Combine(I.current.tempFolder, Paths.framesDir), false); Logger.Log($"Deleted already processed input frames - {inputFramesLeft} left to interpolate"); if(inputFramesLeft < 2) { - string videoChunksFolder = Path.Combine(I.current.tempFolder, Paths.chunksDir); - if(IoUtils.GetAmountOfFiles(videoChunksFolder, true, "*.*") > 0) { Logger.Log($"No more frames left to interpolate - Merging existing video chunks instead.");