Fixed batch processing with refactored code

This commit is contained in:
N00MKRAD
2020-12-18 00:19:08 +01:00
parent 6947bd3e6c
commit 0b9654c80f
6 changed files with 32 additions and 17 deletions

View File

@@ -54,6 +54,7 @@ namespace Flowframes
public static async Task ImportImages(string inpath, string outpath, bool delSrc = false, bool showLog = true)
{
if (showLog) Logger.Log("Importing images...");
Logger.Log($"Importing images from {inpath} to {outpath}.");
IOUtils.CreateDir(outpath);
string concatFile = Path.Combine(Paths.GetDataPath(), "png-concat-temp.ini");
string concatFileContent = "";

View File

@@ -35,10 +35,32 @@ namespace Flowframes
outMode = outModeArg;
tilesize = tilesizeArg;
try
{
tempFolder = InterpolateUtils.GetTempFolderLoc(inPath, outPath);
framesFolder = Path.Combine(tempFolder, Paths.framesDir);
interpFolder = Path.Combine(tempFolder, Paths.interpDir);
inputIsFrames = IOUtils.IsPathDirectory(inPath);
outFilename = Path.Combine(outPath, Path.GetFileNameWithoutExtension(inPath) + IOUtils.GetAiSuffix(ai, interpFactor) + InterpolateUtils.GetExt(outMode));
}
catch
{
Logger.Log("Tried to create InterpSettings struct without an inpath. Can't set tempFolder, framesFolder and interpFolder.", true);
tempFolder = "";
framesFolder = "";
interpFolder = "";
inputIsFrames = false;
outFilename = "";
}
}
public void UpdatePaths (string inPathArg, string outPathArg)
{
inPath = inPathArg;
outPath = outPathArg;
tempFolder = InterpolateUtils.GetTempFolderLoc(inPath, outPath);
framesFolder = Path.Combine(tempFolder, Paths.framesDir);
interpFolder = Path.Combine(tempFolder, Paths.interpDir);
inputIsFrames = IOUtils.IsPathDirectory(inPath);
outFilename = Path.Combine(outPath, Path.GetFileNameWithoutExtension(inPath) + IOUtils.GetAiSuffix(ai, interpFactor) + InterpolateUtils.GetExt(outMode));
}

View File

@@ -115,9 +115,10 @@ namespace Flowframes.Forms
}
public async Task LoadDroppedPaths (string[] droppedPaths)
{
{
foreach (string path in droppedPaths)
{
Logger.Log($"Dropped file: '{path}'", true);
string frame1 = Path.Combine(path, "00000001.png");
if (IOUtils.IsPathDirectory(path) && !File.Exists(frame1))
{
@@ -125,11 +126,11 @@ namespace Flowframes.Forms
continue;
}
InterpSettings dragDropEntry = Program.mainForm.GetCurrentSettings();
dragDropEntry.inPath = path;
dragDropEntry.outPath = path.GetParentDir();
dragDropEntry.inFps = GetFramerate(path);
Program.batchQueue.Enqueue(dragDropEntry);
InterpSettings current = Program.mainForm.GetCurrentSettings();
current.UpdatePaths(path, path.GetParentDir());
current.inFps = GetFramerate(path);
current.outFps = current.inFps * current.interpFactor;
Program.batchQueue.Enqueue(current);
RefreshGui();
await Task.Delay(100);
}

View File

@@ -59,8 +59,6 @@ namespace Flowframes.Main
SetBusy(true);
Program.mainForm.LoadBatchEntry(entry); // Load entry into GUI
Interpolate.current = entry;
// Interpolate.interpFactor = entry.interpFactor;
// Interpolate.SetFps(entry.inFps);
Program.mainForm.runBtn_Click(null, null);
await Task.Delay(2000);

View File

@@ -32,13 +32,6 @@ namespace Flowframes
static Stopwatch sw = new Stopwatch();
public static void SetFps(float inFps)
{
// TODO: Can't I remove this?
current.SetFps(inFps);
}
public static async void Start()
{
canceled = false;

View File

@@ -269,7 +269,7 @@ namespace Flowframes.Main
}
else
{
return resolution;
return new Size(RoundDiv2(resolution.Width), RoundDiv2(resolution.Height));
}
}