/// <summary> /// Debug Test Button /// </summary> private void btnDebugTest_Click(object sender, RoutedEventArgs e) { MainWindow mainwindow = (MainWindow)System.Windows.Application.Current.MainWindow; ViewModel vm = mainwindow.DataContext as ViewModel; // ------------------------- // Clear Variables before Run // ------------------------- MainWindow.ClearGlobalVariables(vm); // ------------------------- // Batch Extention Period Check // ------------------------- MainWindow.BatchExtCheck(vm); // ------------------------- // Set FFprobe Path // ------------------------- MainWindow.FFprobePath(vm); // ------------------------- // Set youtube-dl Path // ------------------------- MainWindow.youtubedlPath(vm); // ------------------------- // Ready Halts // ------------------------- if (MainWindow.ReadyHalts(vm) == true) { // ------------------------- // Single // ------------------------- if (vm.Batch_IsChecked == false) { // ------------------------- // FFprobe Detect Metadata // ------------------------- FFprobe.Metadata(vm); // ------------------------- // FFmpeg Generate Arguments (Single) // ------------------------- //disabled if batch FFmpeg.FFmpegSingleGenerateArgs(vm); } // ------------------------- // Batch // ------------------------- else if (vm.Batch_IsChecked == true) { // ------------------------- // FFprobe Video Entry Type Containers // ------------------------- FFprobe.VideoEntryType(vm); // ------------------------- // FFprobe Video Entry Type Containers // ------------------------- FFprobe.AudioEntryType(vm); // ------------------------- // FFmpeg Generate Arguments (Batch) // ------------------------- //disabled if single file FFmpeg.FFmpegBatchGenerateArgs(vm); } // ------------------------- // Write Variables to Debug Window // ------------------------- DebugWrite(this, vm); // ------------------------- // Clear Variables for next Run // ------------------------- MainWindow.ClearGlobalVariables(vm); GC.Collect(); } }
// -------------------------------------------------------------------------------------------------------- /// <summary> /// FFmpeg Batch - Generate Args /// </summary> public static void FFmpegBatchGenerateArgs(MainWindow mainwindow) { if (mainwindow.tglBatch.IsChecked == true) { // Replace ( with ^( to avoid Windows 7 CMD Error //important! // This is only used in select areas //MainWindow.batchInputAuto = mainwindow.textBoxBrowse.Text.Replace(@"(", "^("); //MainWindow.batchInputAuto = MainWindow.batchInputAuto.Replace(@")", "^)"); // Log Console Message ///////// Log.WriteAction = () => { Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new Bold(new Run("Batch: ")) { Foreground = Log.ConsoleDefault }); Log.logParagraph.Inlines.Add(new Run(Convert.ToString(mainwindow.tglBatch.IsChecked)) { Foreground = Log.ConsoleDefault }); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new Bold(new Run("Generating Batch Script...")) { Foreground = Log.ConsoleTitle }); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new LineBreak()); Log.logParagraph.Inlines.Add(new Bold(new Run("Running Batch Convert...")) { Foreground = Log.ConsoleAction }); }; Log.LogActions.Add(Log.WriteAction); // ------------------------- // Batch Arguments Full // ------------------------- // Make List // List <string> FFmpegBatchArgsList = new List <string>() { "cd /d", "\"" + MainWindow.BatchInputDirectory(mainwindow) + "\"", "\r\n\r\n" + "&& for %f in", "(*" + MainWindow.batchExt + ")", "do (echo)", "\r\n\r\n" + Video.BatchVideoQualityAuto(mainwindow), "\r\n\r\n" + Audio.BatchAudioQualityAuto(mainwindow), "\r\n\r\n" + Audio.BatchAudioBitrateLimiter(mainwindow), "\r\n\r\n" + "&&", "\r\n\r\n" + MainWindow.FFmpegPath(mainwindow), "-y", "-i", //%~f added in InputPath() FFmpeg.OnePassArgs(mainwindow), //disabled if 2-Pass FFmpeg.TwoPassArgs(mainwindow) //disabled if 1-Pass }; // Join List with Spaces // Remove: Empty, Null, Standalone LineBreak ffmpegArgsSort = string.Join(" ", FFmpegBatchArgsList .Where(s => !string.IsNullOrEmpty(s)) .Where(s => !s.Equals("\r\n\r\n")) .Where(s => !s.Equals("\r\n")) ); // Inline ffmpegArgs = string.Join(" ", FFmpegBatchArgsList .Where(s => !string.IsNullOrEmpty(s))) .Replace("\r\n", "") //Remove Linebreaks .Replace(Environment.NewLine, ""); } }