Beispiel #1
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();
        }
Beispiel #2
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();
        }
Beispiel #3
0
        public MainController(FormMain gui)
        {
            this.gui  = gui;
            this.auth = new Authentication(this);

            // Initialize variables
            videoUrls  = new List <string>();
            videoNames = new List <string>();
            dlt        = new List <Download>();

            // UI setting
            dlf        = new FormDownloadProgress(gui);
            dlf.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            dlcg       = new FormDownloadCG(dlf, this);


            // get default folder
            downloadFolder        = FolderCtrl.getDownloadDir();
            playFolder            = FolderCtrl.getVideoDir();
            gui.input_dwndir.Text = downloadFolder;

            // listing video
            loadVideoList();
        }