//Returns VideoInfo List (Shared by both audio and video models)
        public static IEnumerable <VideoInfo> GetVideoInfos(YoutubeModel model)
        {
            //Get the available video formats.
            IEnumerable <VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(model.Link);

            return(videoInfos);
        }
Exemple #2
0
        private void UpdateListBox(YoutubeModel model)
        {
            //Add item to download to the beginning of the list
            //If you use Add it adds to the end of the list
            downloadList.Insert(0, model);

            //Update listbox
            listBox1.DataSource = null;
            listBox1.DataSource = downloadList;

            //Reset the textbox where the link was typed in
            txtLink.Text = "";
        }
        //Returns filepath string (Shared by both models)
        public static string GetPath(YoutubeModel model)
        {
            //Decrypts Video if necessary
            if (model.Video.RequiresDecryption)
                DownloadUrlResolver.DecryptDownloadUrl(model.Video);

            //Remove illegal characters from video.Title
            string title = model.Video.Title;
            string cleanTitle = CleanFileName(title);

            //Set FilePath property
            string path = Path.Combine(model.FolderPath, cleanTitle);
            return path;
        }
        //Returns filepath string (Shared by both models)
        public static string GetPath(YoutubeModel model)
        {
            //Decrypts Video if necessary
            if (model.Video.RequiresDecryption)
            {
                DownloadUrlResolver.DecryptDownloadUrl(model.Video);
            }

            //Remove illegal characters from video.Title
            string title      = model.Video.Title;
            string cleanTitle = CleanFileName(title);

            //Set FilePath property
            string path = Path.Combine(model.FolderPath, cleanTitle);

            return(path);
        }
Exemple #5
0
        private void DownloadList()
        {
            if (!Directory.Exists(txtPath.Text))
            {
                MessageBox.Show("Please enter a valid folder");
            }

            else if (downloadList.Count == 0)
            {
                EnableAccessibility();
            }

            else if (downloadList.Count != 0)
            {
                RestrictAccessibility();

                //Update listbox
                listBox1.DataSource = null;
                listBox1.DataSource = downloadList;

                //Get first DownloadItem from list
                YoutubeModel model = (YoutubeModel)downloadList.First();

                //Delete first DownloadItem from list
                downloadList.RemoveAt(0);

                //Download video

                if (model is YoutubeVideoModel)
                {
                    DownloadVideo((YoutubeVideoModel)model);
                }

                //Download audio
                else if (model is YoutubeAudioModel)
                {
                    DownloadAudio((YoutubeAudioModel)model);
                }
            }
        }
 //Returns VideoInfo List (Shared by both audio and video models)
 public static IEnumerable<VideoInfo> GetVideoInfos(YoutubeModel model)
 {
     //Get the available video formats.
     IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(model.Link);
     return videoInfos;
 }
        private void UpdateListBox(YoutubeModel model)
        {
            //Add item to download to the beginning of the list
            //If you use Add it adds to the end of the list
            downloadList.Insert(0, model);

            //Update listbox
            listBox1.DataSource = null;
            listBox1.DataSource = downloadList;

            //Reset the textbox where the link was typed in
            txtLink.Text = "";
        }