private void NextStepIsToChooseQuality()
        {
            if (CsDownloadVidFilepaths.GetYtdlPath(cbUsePytube.Checked,
                                                   required: false) == null)
            {
                return;
            }

            listBoxFmts.Items.Clear();
            AddGenericFormatsToListbox();
            GetOptionsFromUI(out List <string> urlsRet, out int waitBetween,
                             out string filenamePattern, out string outDir);

            // look up formats
            txtStatus.Visible                   = true;
            lblShortStatus.Visible              = true;
            panelChooseQuality.Visible          = true;
            btnNextStepIsToChooseOutput.Enabled = false;
            btnNextStepIsToChooseOutput.Text    = "Looking up formats...";
            var urlToGet = urlsRet[0];
            var info     = GetStartInfo(urlToGet, "", true);

            // run all in a separate thread, so that UI remains responsive.
            _runner.RunInThread(() =>
            {
                LoadFormats_StartProc(urlToGet, info);
            });
        }
Esempio n. 2
0
 private void btnJoin_Click(object sender, EventArgs e)
 {
     _runner.RunInThread(() =>
     {
         var lines        = GetInputFiles(minExpected: 2);
         var outputFormat = this.tbOutputFormat.Text;
         MediaJoin(lines, outputFormat);
     });
 }
        private void SplitWithFadeout(string inputFile, List <double> splitPoints,
                                      string sFadeLength)
        {
            const int sampleRate  = 44100;
            string    outFilename = inputFile + "_fadeout.m4a";

            if (!double.TryParse(sFadeLength, out double fadeLength) || fadeLength <= 0)
            {
                throw new CsDownloadVidException("Invalid fadelength, expected a number of " +
                                                 "seconds like 4");
            }
            else if (splitPoints.Count == 0)
            {
                throw new CsDownloadVidException("Enter a time, in seconds");
            }
            else if (splitPoints.Count != 1)
            {
                throw new CsDownloadVidException("It looks like you have entered more than " +
                                                 "one time point. Please enter just one time, in seconds.");
            }
            else if (!inputFile.EndsWith(".m4a"))
            {
                throw new CsDownloadVidException("We currently only support adding fadeout " +
                                                 "for m4a files (if you have a .mp4 song, please rename it to .m4a first).");
            }
            else if (File.Exists(outFilename))
            {
                throw new CsDownloadVidException("Output file already exists " + outFilename);
            }

            // preemptively make sure we have a path to qaac.
            CsDownloadVidFilepaths.GetQaac();

            // run all in a separate thread, so that UI remains responsive.
            _runner.RunInThread(() =>
            {
                var log = "";
                new AddFadeoutUsingRawAacData().Go(inputFile, sampleRate, splitPoints[0],
                                                   fadeLength, outFilename, ref log);

                _runner.TraceFiltered(log.Replace("\n", Utils.NL));
                _runner.Trace(File.Exists(outFilename) ? "Successfully saved to " + outFilename :
                              "Error(s) occurred");
            });
        }