Exemplo n.º 1
0
        //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);
        }
Exemplo n.º 2
0
        private void UpdateDownloadList(YoutubeModel aModel, string aLink)
        {
            ucDownloadInfoBox downInfoBox = new ucDownloadInfoBox();

            downInfoBox.Width = this.flpDownloadList.Width - 20;
            downInfoBox.SetDownloadInfo(aModel, aLink);
            this.flpDownloadList.Controls.Add(downInfoBox);

            //Reset the textbox where the link was typed in
            this.tbxYoutubeUrl.Text = string.Empty;
        }
Exemplo n.º 3
0
        public void Download()
        {
            //Get first DownloadItem from list
            YoutubeModel model = this.mYoutubeModel;

            //Download video
            if (model is YoutubeVideoModel)
            {
                DownloadVideo((YoutubeVideoModel)model);
            }
        }
Exemplo n.º 4
0
        //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);
        }
Exemplo n.º 5
0
        public void SetDownloadInfo(YoutubeModel aYoutubeModel, string aLink)
        {
            this.mYoutubeModel = aYoutubeModel;
            this.lblTitle.Text = aYoutubeModel.Video.Title;
            string youtubeCode = aLink.Substring(aLink.Length - 11, 11);

            string imageLink1 = "http://img.youtube.com/vi/" + youtubeCode + "/1.jpg";

            using (var client = new WebClient())
            {
                client.DownloadFile(imageLink1, "1.jpg");
            }

            FileStream fs = new System.IO.FileStream("1.jpg", System.IO.FileMode.Open, System.IO.FileAccess.Read);

            this.pbxPreview.Image = System.Drawing.Image.FromStream(fs);
            fs.Close();

            File.Delete("1.jpg");
        }