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

            bool start = Program.initialRun && Program.args.Contains("start");

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

                bool resume = (IoUtils.GetAmountOfFiles(Path.Combine(files[0], Paths.resumeDir), true, "*.json") > 0);
                AutoEncodeResume.resumeNextRun = resume;

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

                trimCombox.SelectedIndex = 0;

                MainUiFunctions.InitInput(outputTbox, inputTbox, fpsInTbox, start);
            }
        }
Exemple #2
0
        public static async Task Start()
        {
            if (!BatchProcessing.busy && Program.busy)
            {
                return;
            }
            canceled           = false;
            Program.initialRun = false;
            Program.mainForm.SetWorking(true);
            if (!Utils.InputIsValid(current.inPath, current.outPath, current.inFps, current.interpFactor, current.outMode))
            {
                return;                                                                                                                 // General input checks
            }
            if (!Utils.CheckAiAvailable(current.ai, current.model))
            {
                return;                                                                // Check if selected AI pkg is installed
            }
            if (!AutoEncodeResume.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.ShowWarnings(current.interpFactor, current.ai);
            currentInputFrameCount = await GetFrameCountCached.GetFrameCountAsync(current.inPath);

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

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

                if (canceled)
                {
                    return;
                }
                await PostProcessFrames(false);
            }

            if (canceled)
            {
                return;
            }
            bool skip = await AutoEncodeResume.PrepareResumedRun();

            if (skip || canceled)
            {
                return;
            }
            //Task.Run(() => Utils.DeleteInterpolatedInputFrames());
            await RunAi(current.interpFolder, current.ai);

            if (canceled)
            {
                return;
            }
            Program.mainForm.SetProgress(100);

            if (!currentlyUsingAutoEnc)
            {
                await Export.ExportFrames(current.interpFolder, current.outPath, current.outMode, false);
            }

            if (!AutoEncodeResume.resumeNextRun && Config.GetBool(Config.Key.keepTempFolder))
            {
                await Task.Run(async() => { await FrameRename.Unrename(); });
            }

            await Done();
        }