Delete invalid/incomplete chunks before resuming to avoid duplicate chunks

This commit is contained in:
n00mkrad
2021-09-29 23:49:26 +02:00
parent 6cb95a2374
commit 3caa1ec6c2

View File

@@ -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.");