Inheritance: YouTubeModel
        //Returns VideoInfo object (Only for video model)
        public static VideoInfo GetVideoInfo(YouTubeVideoModel videoModel)
        {
            //Select the first .mp4 video with 360p resolution
            VideoInfo video = videoModel.VideoInfo.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);

            return(video);
        }
Example #2
0
 private void DownloadVideo(YouTubeVideoModel videoDownloader)
 {
     try
     {
         //Store VideoInfo object in model
         videoDownloader.VideoInfo = FileDownloader.GetVideoInfos(videoDownloader);
         //Stores VideoInfo object in model
         videoDownloader.Video = FileDownloader.GetVideoInfo(videoDownloader);
         UpdateLabel(videoDownloader.Video.Title + videoDownloader.Video.VideoExtension);
         //Stores FilePath in model
         videoDownloader.FilePath  = FileDownloader.GetPath(videoDownloader);
         videoDownloader.FilePath += videoDownloader.Video.VideoExtension;
         //Stores VideoDownloaderType object in model
         videoDownloader.VideoDownloaderType = FileDownloader.GetVideoDownloader(videoDownloader);
         //stop timer after download
         videoDownloader.VideoDownloaderType.DownloadFinished += (sender, args) => timer1.Stop();
         //Enable interface once download is complete
         videoDownloader.VideoDownloaderType.DownloadFinished += (sender, args) => EnableAccessibility();
         //open folder with downloaded file selected
         videoDownloader.VideoDownloaderType.DownloadFinished        += (sender, args) => OpenFolder(videoDownloader.FilePath);
         videoDownloader.VideoDownloaderType.DownloadProgressChanged += (sender, args) => pgDownload.Value = (int)args.ProgressPercentage;
         CheckForIllegalCrossThreadCalls = false;
         //download video
         FileDownloader.DownloadVideo(videoDownloader);
     }
     catch (Exception)
     {
         MessageBox.Show("Download canceled.");
         EnableAccessibility();
     }
 }
Example #3
0
        private void DownloadVideo(YouTubeVideoModel videoDownloader)
        {
            try
            {
                //Store VideoInfo object in model
                videoDownloader.VideoInfo = FileDownloader.GetVideoInfos(videoDownloader);
                //Stores VideoInfo object in model
                videoDownloader.Video = FileDownloader.GetVideoInfo(videoDownloader);
                UpdateLabel(videoDownloader.Video.Title + videoDownloader.Video.VideoExtension);
                //Stores FilePath in model
                videoDownloader.FilePath = FileDownloader.GetPath(videoDownloader);
                videoDownloader.FilePath += videoDownloader.Video.VideoExtension;
                //Stores VideoDownloaderType object in model
                videoDownloader.VideoDownloaderType = FileDownloader.GetVideoDownloader(videoDownloader);
                //Enable interface once download is complete
                videoDownloader.VideoDownloaderType.DownloadFinished += (sender, args) => EnableAccessibility();
                //open folder with downloaded file selected
                videoDownloader.VideoDownloaderType.DownloadFinished += (sender, args) => OpenFolder(videoDownloader.FilePath);
                videoDownloader.VideoDownloaderType.DownloadProgressChanged += (sender, args) => pgDownload.Value =(int)args.ProgressPercentage;
                CheckForIllegalCrossThreadCalls = false;
                //download video
                FileDownloader.DownloadVideo(videoDownloader);

            }
            catch (Exception)
            {
               MessageBox.Show("Download canceled.");
               EnableAccessibility();
            }
        }
Example #4
0
 private void Download(string validatedLink)
 {
     if(cboFileType.SelectedIndex ==0) //user wants to download video
     {
         YouTubeVideoModel videoDownloader = new YouTubeVideoModel();
         videoDownloader.Link = validatedLink;
         videoDownloader.FolderPath = txtDownloadFolder.Text;
         FileDownloader.DownloadVideo(videoDownloader);
     }
 }
Example #5
0
 private void Download(string validatedLink)
 {
     if (cboFileType.SelectedIndex == 0) //user wants to download video
     {
         YouTubeVideoModel videoDownloader = new YouTubeVideoModel();
         videoDownloader.Link       = validatedLink;
         videoDownloader.FolderPath = txtDownloadFolder.Text;
         FileDownloader.DownloadVideo(videoDownloader);
     }
 }
Example #6
0
 private void Download(string validatedLink)
 {
     if (cboFileType.SelectedIndex == 0)
     {
         YouTubeVideoModel videoDownloader = new YouTubeVideoModel();
         videoDownloader.Link       = validatedLink;
         videoDownloader.FolderPath = txtDownloadFolder.Text;
         DownloadVideo(videoDownloader);
     }
     else
     {
         YouTubeAudioModel audioDownloader = new YouTubeAudioModel();
         audioDownloader.Link       = validatedLink;
         audioDownloader.FolderPath = txtDownloadFolder.Text;
         DownloadAudio(audioDownloader);
     }
 }
Example #7
0
 private void Download(string validatedLink)
 {
     if(cboFileType.SelectedIndex ==0)
     {
         YouTubeVideoModel videoDownloader = new YouTubeVideoModel();
         videoDownloader.Link = validatedLink;
         videoDownloader.FolderPath = txtDownloadFolder.Text;
         DownloadVideo(videoDownloader);
     }
     else
     {
         YouTubeAudioModel audioDownloader = new YouTubeAudioModel();
         audioDownloader.Link = validatedLink;
         audioDownloader.FolderPath = txtDownloadFolder.Text;
         //DownloadAudio(audioDownloader);
     }
 }
Example #8
0
 private void DownloadVideo(YouTubeVideoModel videoDownloader)
 {
     try
     {
         //Store VideoInfo object in model
         videoDownloader.VideoInfo = FileDownloader.GetVideoInfos(videoDownloader);
         //Stores VideoInfo object in model
         videoDownloader.Video = FileDownloader.GetVideoInfo(videoDownloader);
         //Stores FilePath in model
         videoDownloader.FilePath = FileDownloader.GetPath(videoDownloader);
         videoDownloader.FilePath += videoDownloader.Video.VideoExtension;
         //Stores VideoDownloaderType object in model
         videoDownloader.VideoDownloaderType = FileDownloader.GetVideoDownloader(videoDownloader);
         //Download video
         FileDownloader.DownloadVideo(videoDownloader);
     }
     catch (Exception)
     {
        MessageBox.Show("Download canceled.");
        EnableAccessibility();
     }
 }
Example #9
0
 private void DownloadVideo(YouTubeVideoModel videoDownloader)
 {
     try
     {
         //Store VideoInfo object in model
         videoDownloader.VideoInfo = FileDownloader.GetVideoInfos(videoDownloader);
         //Stores VideoInfo object in model
         videoDownloader.Video = FileDownloader.GetVideoInfo(videoDownloader);
         //Stores FilePath in model
         videoDownloader.FilePath  = FileDownloader.GetPath(videoDownloader);
         videoDownloader.FilePath += videoDownloader.Video.VideoExtension;
         //Stores VideoDownloaderType object in model
         videoDownloader.VideoDownloaderType = FileDownloader.GetVideoDownloader(videoDownloader);
         //Download video
         FileDownloader.DownloadVideo(videoDownloader);
     }
     catch (Exception)
     {
         MessageBox.Show("Download canceled.");
         EnableAccessibility();
     }
 }
 //Downloads Video (Only for video model)
 public static void DownloadVideo(YouTubeVideoModel vidDownloader)
 {
     Task.Run(() => vidDownloader.VideoDownloaderType.Execute());
 }
 //Returns VideoDownloader object (Only for video model)
 public static VideoDownloader GetVideoDownloader(YouTubeVideoModel videoModel)
 {
     return(new VideoDownloader(videoModel.Video, videoModel.FilePath));
 }
 //Returns VideoInfo object (Only for video model)
 public static VideoInfo GetVideoInfo(YouTubeVideoModel videoModel)
 {
     //Select the first .mp4 video with 360p resolution
      VideoInfo video = videoModel.VideoInfo.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
      return video;
 }
 //Returns VideoDownloader object (Only for video model)
 public static VideoDownloader GetVideoDownloader(YouTubeVideoModel videoModel)
 {
     return new VideoDownloader(videoModel.Video, videoModel.FilePath);
 }
 //Downloads Video (Only for video model)
 public static void DownloadVideo(YouTubeVideoModel vidDownloader)
 {
     Task.Run(() => vidDownloader.VideoDownloaderType.Execute());
 }