Esempio n. 1
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     RunToolHelper.RunAndCatch(() =>
     {
         _runner.CancelProcess();
     });
 }
        private void btnSplit_Click(object sender, EventArgs e)
        {
            RunToolHelper.RunAndCatch(() =>
            {
                var input = txtInput.Text;
                var times = GetSplitTimes(txtSplitpoints.Text);
                if (times.Count == 0)
                {
                    throw new CsDownloadVidException("No split points added.");
                }
                else if (!File.Exists(input))
                {
                    throw new CsDownloadVidException("Input file not found");
                }

                if (!(input.EndsWith(".m4a") || input.EndsWith(".m4v")))
                {
                    if (!Utils.AskToConfirm("Warning: designed for .m4a or .m4v files, " +
                                            "this might not work. Continue?"))
                    {
                        return;
                    }
                }

                if (checkBoxFadeout.Checked)
                {
                    SplitWithFadeout(input, times, txtFadeLength.Text);
                }
                else
                {
                    SplitMedia(input, times);
                }
            });
        }
        private void btnGetPlaylist_Click(object sender, EventArgs e)
        {
            var url = txtUrl.Text;

            if (string.IsNullOrWhiteSpace(url))
            {
                MessageBox.Show("no url entered. please enter one of the url with a " +
                                "playlist in the box for 'step 1'.");
                return;
            }
            else if (!Utils.AskToConfirm("Get playlist for " + url + "?"))
            {
                return;
            }

            var txtPath = Utils.AskSaveFileDialog("Save playlist video ids to what text file?",
                                                  new string[] { ".txt" }, new string[] { "Text file" });

            if (string.IsNullOrEmpty(txtPath))
            {
                return;
            }

            RunToolHelper.RunAndCatch(() =>
            {
                _runner.RunInThread(() =>
                {
                    GetPlaylistStart(url, txtPath);
                },
                                    "Getting playlist...");
            });
        }
        private void btnImportAudacity_Click(object sender, EventArgs e)
        {
            var file = Utils.AskOpenFileDialog("Choose Audacity text file " +
                                               "(File->Export labels as text)", new string[] { "*.txt" });

            if (file != null)
            {
                var lines = File.ReadAllLines(file);
                RunToolHelper.RunAndCatch(() => ImportAudacity(lines));
            }
        }
 private void btnGetUpdates_Click(object sender, EventArgs e)
 {
     RunToolHelper.RunAndCatch(() =>
     {
         _runner.RunInThread(() =>
         {
             GetUpdatesImpl();
         },
                             "Getting new youtube-dl...");
     });
 }
 private void btnShowSum_Click(object sender, EventArgs e)
 {
     RunToolHelper.RunAndCatch(() =>
     {
         var splitPoints   = GetSplitTimes(txtSplitpoints.Text);
         double total      = splitPoints.Sum();
         double subseconds = total - (int)total;
         int seconds       = ((int)total) % 60;
         int minutes       = ((int)total) / 60;
         MessageBox.Show("Sum of all times is " + minutes + ":" +
                         seconds + subseconds.ToString("#.0000"));
     });
 }
        private void btnDownloadFromWeb_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Go to the Chrome Inspector, go to the Network tab, " +
                            "and refresh the page. Look for a .mp4, .m3u, or .m3u8 url.");
            var url = InputBoxForm.GetStrInput("Enter the url that was seen,");

            if (!String.IsNullOrEmpty(url))
            {
                RunToolHelper.RunAndCatch(() =>
                {
                    downloadFromWeb(url);
                });
            }
        }
Esempio n. 8
0
        private void doCustomEncode(string example, InputBoxHistory key)
        {
            var files = this.GetInputFiles(1);
            var cmd   = InputBoxForm.GetStrInput("Command for the ffmpeg encoder:", example,
                                                 key);

            if (String.IsNullOrEmpty(cmd))
            {
                return;
            }
            else if (!cmd.Contains("%in%") && !Utils.AskToConfirm("Did not see '%in%', " +
                                                                  "won't process input files. Continue?"))
            {
                return;
            }

            if (!Utils.AskToConfirm("Run the command right now? (or copy the command line to the clipboard)"))
            {
                var s = "";
                foreach (var file in files)
                {
                    s += "\r\n\"" + CsDownloadVidFilepaths.GetFfmpeg() + "\" ";
                    s += cmd.Replace("%in%", files[0]);
                }

                Clipboard.SetText(s);
                MessageBox.Show("Command was copied to the clipboard.");
                return;
            }

            RunToolHelper.RunAndCatch(() =>
            {
                var infos = new List <ProcessStartInfo>();
                foreach (var file in files)
                {
                    var info                    = new ProcessStartInfo();
                    info.FileName               = CsDownloadVidFilepaths.GetFfmpeg();
                    info.Arguments              = cmd.Replace("%in%", file);
                    info.CreateNoWindow         = true;
                    info.RedirectStandardError  = true;
                    info.RedirectStandardOutput = true;
                    info.UseShellExecute        = false;
                    infos.Add(info);
                }

                _runner.RunProcesses(infos.ToArray(), "Custom encode");
            });
        }
 private void btnNextToChooseQuality_Click(object sender, EventArgs e)
 {
     RunToolHelper.RunAndCatch(() => NextStepIsToChooseQuality());
 }
Esempio n. 10
0
        private void getVideo_Click(object sender, EventArgs e)
        {
            var suggestedFormat = tbOutputFormat.Text;

            RunToolHelper.RunAndCatch(() => GoExtract(false, suggestedFormat));
        }
Esempio n. 11
0
 private void txtInput_Click(object sender, EventArgs e)
 {
     RunToolHelper.RunAndCatch(() => btnGetInput_Click(sender, e));
 }