public static VideoInfo GetPlayerSources(string url) { VideoInfo videoInfo = new VideoInfo(); var videoID = VideoLink.GetVideoID(url); string videoInfoLink = string.Format("https://www.youtube.com/get_video_info?video_id={0}&el=detailpage&hl=en", videoID); var rawVideoInfo = WebHelper.GetPageSouce(videoInfoLink); var videoPage = WebHelper.GetPageSouce(url); var dataRegex = new Regex(@"ytplayer\.config\s*=\s*(\{.+?\});", RegexOptions.Multiline); string extractedJson = dataRegex.Match(videoPage).Result("$1"); videoInfo.rawVideoInfo = JsonHelper.ConvertToJson(rawVideoInfo); videoInfo.videoPage = JObject.Parse(extractedJson); Debug.SaveFile(videoInfo.rawVideoInfo.ToString(), "VideoInfoJson"); Debug.SaveFile(videoInfo.videoPage.ToString(), "VideoPageJson"); return(videoInfo); }
public MainWindow() { InitializeComponent(); youtubeLink = new YoutubeLink(); VideoLink.SetBinding(TextBox.TextProperty, new Binding("link") { Source = youtubeLink, Mode = BindingMode.OneWayToSource, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); VideoTitle.SetBinding(Label.ContentProperty, new Binding("title") { Source = youtubeLink, Mode = BindingMode.OneWay }); VideoProgress.SetBinding(ProgressBar.ValueProperty, new Binding("progress") { Source = youtubeLink, Mode = BindingMode.OneWay }); VideoImage.SetBinding(Image.SourceProperty, new Binding("image") { Source = youtubeLink, Mode = BindingMode.OneWay }); }
public bool Equals(DestinySeasonPreviewDefinition input) { if (input == null) { return(false); } return (( Description == input.Description || (Description != null && Description.Equals(input.Description)) ) && ( LinkPath == input.LinkPath || (LinkPath != null && LinkPath.Equals(input.LinkPath)) ) && ( VideoLink == input.VideoLink || (VideoLink != null && VideoLink.Equals(input.VideoLink)) ) && ( Images == input.Images || (Images != null && Images.SequenceEqual(input.Images)) )); }
public async Task SaveVideoLinksAsyncTest() { // Arrange var ids = new string[] { "id1", "id0" }; var linksToSave = new VideoLink[] { new VideoLink() { Id = ids[0] }, new VideoLink() { Id = ids[1] }, }; _videoLinkRepositoryMock.Setup(r => r.GetByIdsAsync(ids)) .ReturnsAsync(new VideoLinkEntity[] { new VideoLinkEntity() { Id = ids[1] } }); // Act await _service.SaveVideoLinksAsync(linksToSave); // Assert _videoLinkRepositoryMock.Verify(x => x.GetByIdsAsync(It.IsAny <IEnumerable <string> >()), Times.Once); _eventPublisherMock.Verify(x => x.Publish( It.Is <ProductVideoAddedEvent>(x => x.ChangedEntries.Any(y => y.NewEntry.Id == ids[0])), default ), Times.Once); }
private DealerVideoSummary ToDealerVideoSummary( VideoLink video ) { return new DealerVideoSummary() { VideoID = video.VideoID, Name = video.Display }; }
private DealerVideoInformation ToDealerVideoInformation( VideoLink video ) { return new DealerVideoInformation() { VideoID = video.VideoID, Name = video.Display, YouTubeID = video.YouTubeID }; }
public async Task <ActionResult> DeleteConfirmed(int id) { VideoLink videoLink = await db.VideoLinks.FindAsync(id); db.VideoLinks.Remove(videoLink); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public bool AddDealerVideo( DealerVideoInformation vInfo ) { VideoLink newVideo = new VideoLink(); newVideo.Display = vInfo.Name; newVideo.YouTubeID = vInfo.YouTubeID; database.VideoLinks.Add( newVideo ); return database.SaveChanges() > 0; }
public static VideoLinkModel Map(VideoLink objModel) { return(new VideoLinkModel { Id = objModel.Id, VideoLinkUrl = objModel.VideoLinkUrl, SectionId = objModel.SectionId, CreatedDate = objModel.CreatedDate }); }
public async Task <IHttpActionResult> GetVideoLink(int id) { VideoLink videoLink = await db.VideoLinks.FindAsync(id); if (videoLink == null) { return(NotFound()); } return(Ok(videoLink)); }
public async Task <ActionResult> Edit([Bind(Include = "VideoLinkId,MinutesRequired,Description,Link")] VideoLink videoLink) { if (ModelState.IsValid) { db.Entry(videoLink).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(videoLink)); }
public static async Task <BitmapImage> GetThumbnailAsync(string videoURL, IProgress <DownloadProgressData> progress) { string videoID = VideoLink.GetVideoID(videoURL); string thumbURL = string.Format("https://i.ytimg.com/vi/{0}/maxresdefault.jpg", videoID); string fileName = string.Format("thumb-{0}.jpg", videoID); await Task.Run(() => Download.DownloadContent(thumbURL, fileName, Debug.savePath, progress)); var path = new Uri(Debug.savePath + fileName); return(new BitmapImage(path)); }
public async Task <ActionResult> Create([Bind(Include = "VideoLinkId,MinutesRequired,Description,Link")] VideoLink videoLink) { if (ModelState.IsValid) { db.VideoLinks.Add(videoLink); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(videoLink)); }
private ChannelItemInfo CreateChannelItemVideo(VideoLink videoLink) { var twitchVideoId = new TwitchVideoId(videoLink.TwitchId, videoLink.TimeStart); return(new ChannelItemInfo { ContentType = ChannelMediaContentType.Clip, Id = twitchVideoId.ToString(), MediaType = ChannelMediaType.Video, Name = videoLink.Title, Type = ChannelItemType.Media }); }
// GET: BackEnd/VideoLinks/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VideoLink videoLink = await db.VideoLinks.FindAsync(id); if (videoLink == null) { return(HttpNotFound()); } return(View(videoLink)); }
public virtual VideoLink ToModel(VideoLink videolink) { if (videolink == null) { throw new ArgumentNullException(nameof(videolink)); } videolink.Id = Id; videolink.Url = Url; videolink.ProductId = ProductId; videolink.CreatedDate = CreatedDate; videolink.ModifiedDate = ModifiedDate; videolink.Status = Status; return(videolink); }
protected virtual IndexDocument CreateDocument(VideoLink link) { var document = new IndexDocument(link.Id); document.AddFilterableValue("__sort", link.Url); var statusField = Enum.GetName(typeof(VideoLinkStatus), link.Status); IndexIsProperty(document, statusField); document.AddFilterableValue("status", statusField); document.AddFilterableValue("createddate", link.CreatedDate); document.AddFilterableValue("lastmodifieddate", link.ModifiedDate ?? DateTime.MaxValue); document.AddFilterableValue("modifieddate", link.ModifiedDate ?? DateTime.MaxValue); return(document); }
public virtual VideoLinkEntity FromModel(VideoLink videolink, PrimaryKeyResolvingMap pkMap) { if (videolink == null) { throw new ArgumentNullException(nameof(videolink)); } pkMap.AddPair(videolink, this); Id = videolink.Id; Url = videolink.Url; ProductId = videolink.ProductId; CreatedDate = videolink.CreatedDate; ModifiedDate = videolink.ModifiedDate; Status = videolink.Status; return(this); }
public static void GetJsonResponse(string videoURL) { string videoID = VideoLink.GetVideoID(videoURL); string HTMLDetails; //string videoDetails = string.Format("https://www.youtube.com/get_video_info?video_id={0}&el=detailpage", videoID); string videoDetails = videoURL; using (var client = new WebClient()) { client.Encoding = Encoding.UTF8; HTMLDetails = client.DownloadString(videoDetails); } Debug.SaveFile(HTMLDetails, "YoutubeInfo"); /* * var dictionary1 = new Dictionary<string, string>(); * * foreach (string vp in Regex.Split(HTMLDetails, "&")) * { * string[] strings = Regex.Split(vp, "="); * * dictionary1.Add(strings[0], strings.Length == 2 ? HttpUtility.UrlDecode(strings[1]) : string.Empty); * } * * JObject dic1 = JObject.Parse(JsonConvert.SerializeObject(dictionary1).ToString()); * * SaveFile(dic1.ToString(), "dictionary1"); * * GetNeededData(dic1); */ Regex dataRegex = new Regex(@"ytplayer\.config\s*=\s*(\{.+?\});", RegexOptions.Multiline); string extractedJson = dataRegex.Match(HTMLDetails).Result("$1"); Debug.SaveFile(extractedJson, "EmbedPageJSON"); GetNeededData(JObject.Parse(extractedJson)); }
void Update() { // loading timeout if (ShouldPlay && CurrentState == VideoState.Loading) { loadingTime += Time.deltaTime; if (loadingTime >= timeout) { Debug.LogError("TIMEOUT " + timeout + " VID: " + Link.tag + " || " + Link.title); CurrentState = VideoState.Error; timeout *= 2; } } if (!ShouldPlay || CurrentState != VideoState.Loading) { loadingTime = 0; timeout = InitialTimeout; } // ready to waiting if (ShouldPlay && CurrentState == VideoState.Ready) { CurrentState = VideoState.Waiting; } // load or play switch (CurrentState) { case VideoState.None: case VideoState.Error: Link = VideoManager.Inst.GetUnusedLink(); Player.OpenVideoFromFile(MediaPlayer.FileLocation.AbsolutePathOrURL, Link.vid, false); CurrentState = VideoState.Loading; break; case VideoState.Waiting: Player.Play(); break; } // color flash.color = flash.color.withAlpha(Mathf.Lerp(flash.color.a, 0, FlashSpeed)); }
private async void videoURL_TextChanged(object sender, TextChangedEventArgs e) { if (VideoLink.IsValidLink(videoURL.Text)) { debug.Content = "ValidLink"; vaildLink = true; BitmapImage image = await WebHelper.GetThumbnailAsync(videoURL.Text, progress); VideoThumbnail_Image.Source = image; AvailableFormats.Clear(); videoQuailty_List.Items.Clear(); lister.RunWorkerAsync(argument: videoURL.Text); } else { debug.Content = "NotValidLink"; vaildLink = false; } }