Exemple #1
0
        public void downloadVideo()
        {
            // download_url = "https://www.youtube.com/watch?v=wI__53kBBKM";

            String cmd = download_url + " -o " + storedir_url + "\\%(title)s.%(ext)s --max-downloads 1 --newline";

            p = ProcessCtrl.mkp(@"youtube-dl.exe", cmd);

            mpb.lbn.Text = getTitle();

            if (p == null)
            {
                return;
            }
            try
            {
                while (!p.StandardOutput.EndOfStream)
                {
                    string line     = p.StandardOutput.ReadLine();
                    string progress = line.Substring(10, 4);
                    string text     = line.Substring(12, line.Length - 12);

                    int x = 0;
                    int.TryParse(progress, out x);

                    FormDownloadCG.setValue(mpb, x, text);
                    // Console.WriteLine(mpb.Value);
                }
            } catch (Exception exp)
            {
            }
            downloadFinish();
        }
Exemple #2
0
        public void downloadMusic()
        {
            String cmd = " --extract-audio --audio-format mp3 " + download_url + " -o " + storedir_url + "\\%(title)s.%(ext)s  --max-downloads 1 --newline";

            p = ProcessCtrl.mkp(@"youtube-dl.exe", cmd);

            mpb.lbn.Text = getTitle();

            if (p == null)
            {
                return;
            }
            try
            {
                while (!p.StandardOutput.EndOfStream)
                {
                    string line     = p.StandardOutput.ReadLine();
                    string progress = line.Substring(10, 4);
                    string text     = line.Substring(12, line.Length - 12);

                    int x = 0;
                    int.TryParse(progress, out x);

                    FormDownloadCG.setValue(mpb, x, text);
                }
            } catch (Exception exp)
            {
            }
            downloadFinish();
        }
Exemple #3
0
        public string getTitle()
        {
            String  cmd     = download_url + " -o " + storedir_url + "\\%(title)s.%(ext)s --get-title --max-downloads 1 --newline";
            Process process = ProcessCtrl.mkp(@"youtube-dl.exe", cmd);

            while (!process.StandardOutput.EndOfStream)
            {
                return(process.StandardOutput.ReadLine());
            }
            return("Untitled");
        }