Esempio n. 1
0
        public void DragDropHandler(string[] files)
        {
            if (Program.busy)
            {
                return;
            }

            if (files.Length > 1)
            {
                queueBtn_Click(null, null);
                if (BatchProcessing.currentBatchForm != null)
                {
                    BatchProcessing.currentBatchForm.LoadDroppedPaths(files);
                }
            }
            else
            {
                SetTab("interpolation");
                Logger.Log("Selected video/directory: " + Path.GetFileName(files[0]));
                inputTbox.Text = files[0];

                bool resume = (IOUtils.GetAmountOfFiles(Path.Combine(files[0], Paths.resumeDir), true) > 0);
                ResumeUtils.resumeNextRun = resume;

                if (resume)
                {
                    ResumeUtils.LoadTempFolder(files[0]);
                }

                trimCombox.SelectedIndex = 0;

                MainUiFunctions.InitInput(outputTbox, inputTbox, fpsInTbox);
            }
        }
Esempio n. 2
0
        public static async Task Start()
        {
            if (!BatchProcessing.busy && Program.busy)
            {
                return;
            }
            canceled = false;
            Program.mainForm.SetWorking(true);
            if (!Utils.InputIsValid(current.inPath, current.outPath, current.outFps, current.interpFactor, current.outMode))
            {
                return;                                                                                                                  // General input checks
            }
            if (!Utils.CheckAiAvailable(current.ai))
            {
                return;                                                 // Check if selected AI pkg is installed
            }
            if (!ResumeUtils.resumeNextRun && !Utils.CheckDeleteOldTempFolder())
            {
                return;                                                                       // Try to delete temp folder if an old one exists
            }
            if (!Utils.CheckPathValid(current.inPath))
            {
                return;                                                  // Check if input path/file is valid
            }
            if (!(await Utils.CheckEncoderValid()))
            {
                return;                                               // Check NVENC compat
            }
            Utils.PathAsciiCheck(current.outPath, "output path");
            currentInputFrameCount = await Utils.GetInputFrameCountAsync(current.inPath);

            current.stepByStep = false;
            Program.mainForm.SetStatus("Starting...");

            if (!ResumeUtils.resumeNextRun)
            {
                await GetFrames();

                if (canceled)
                {
                    return;
                }
                sw.Restart();
                await PostProcessFrames(false);
            }

            if (canceled)
            {
                return;
            }
            await ResumeUtils.PrepareResumedRun();

            //Task.Run(() => Utils.DeleteInterpolatedInputFrames());
            await RunAi(current.interpFolder, current.ai);

            if (canceled)
            {
                return;
            }
            Program.mainForm.SetProgress(100);
            if (!currentlyUsingAutoEnc)
            {
                await CreateVideo.Export(current.interpFolder, current.outFilename, current.outMode, false);
            }
            await IOUtils.ReverseRenaming(current.framesFolder, AiProcess.filenameMap);   // Get timestamps back

            AiProcess.filenameMap.Clear();
            await Cleanup();

            Program.mainForm.SetWorking(false);
            Logger.Log("Total processing time: " + FormatUtils.Time(sw.Elapsed));
            sw.Stop();
            Program.mainForm.SetStatus("Done interpolating!");
        }