public void SetVideo(Videos target, bool play = true) { photoImage.gameObject.SetActive(false); videoController.gameObject.SetActive(true); videoController.SetVideo(target,play); ResizeToVideo(); }
protected void Page_Load(object sender, EventArgs e) { int removed = 0; var vids = new Videos(); vids.GetAll(); foreach (Video vv1 in vids) { if (vv1.IsEnabled) { bool? sss = Utilities.GETRequest(new Uri( string.Format("http://i3.ytimg.com/vi/{0}/1.jpg", vv1.ProviderKey)), true); if (sss == null) continue; if (!Convert.ToBoolean(sss)) { vv1.IsEnabled = false; removed++; vv1.Update(); } } } Response.Write(removed); }
private static Videos instantiate(DataSet ds) { Videos v = new Videos(); v.Id = Convert.ToInt16(ds.Tables[0].Rows[0]["id"]); v.CauseId = Convert.ToInt16(ds.Tables[0].Rows[0]["cause_id"]); v.Name = ds.Tables[0].Rows[0]["name"].ToString(); v.Url = ds.Tables[0].Rows[0]["url"].ToString(); v.Date = Convert.ToDateTime(ds.Tables[0].Rows[0]["date"]); return v; }
private void BindVideo(string newVideoId) { videos = videoRepository.GetVideos(GeneralExtensions.GetQueryStringId(), newVideoId); if (!string.IsNullOrEmpty(newVideoId)) { videos.VideoImageUrls.Reverse(); videos.YoutubeVideoDetails.Reverse(); } repVideos.DataSource = videos.VideoImageUrls; repVideos.DataBind(); ltlFeaturedVideo.Text = videos.FeatureVideoUrl; this.cmsRelatedLinks.CollectionFilters.Add(new Ektron.Cms.Framework.UI.Controls.ContentCollectionFilter() { Value = videos.RelatedLinksId, Operator = Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Field = Ektron.Cms.Common.ContentCollectionProperty.Id }); }
private static void VideoCount() { var vids = new Videos(); var conts = new Contests(); conts.GetAll(); int count = 0; int totalVids = 0; foreach (Contest c1 in conts) { var cv = new ContestVideo(); var cvs = new ContestVideos(); cvs.GetContestVideosForContest(c1.ContestID); totalVids += cvs.Count; count += (from cv2 in cvs select new Video(cv2.VideoID) into v1 let doc = new XmlDocument() select Utilities.GETRequest( new Uri("http://gdata.youtube.com/feeds/api/videos/" + v1.ProviderKey + @"?v=2&alt=json")) into s where !string.IsNullOrWhiteSpace(s) select (JObject) JsonConvert.DeserializeObject(s) into JObj select JObj["entry"] into entry from thumbnail in entry["yt$statistics"] where !thumbnail.ToString().Contains("fav") select Convert.ToInt32(thumbnail.ToString() .Replace(@"""viewCount"": """, string.Empty) .Replace(@"""", string.Empty))).Sum(); } }
public AppUser RegisterUser(string uid, string email, string fullname, string accessToken) { TimeFliesByEntities dc = ContextHelper.DataContext; AppUser usr = new AppUser(); usr.UserId = uid; usr.Email = email; usr.FullName = fullname; usr.AccessToken = accessToken; usr.LastLogin = DateTime.Now; usr.IsActive = true; usr.DateAdded = DateTime.Now; dc.User.AddObject(usr); SessionHelper.UserId = usr.UserId; Videos vdo = new Videos(); vdo.VideoId = Guid.NewGuid().ToString().Substring(0, 8); vdo.UserId = usr.UserId; vdo.VideoName = "My Video"; vdo.Publish = "PublicFriends"; vdo.IsReminder = true; vdo.IsSentReminder = false; vdo.IsCompile = false; vdo.IsImage = false; vdo.IsError = false; vdo.IsSoundTrack = false; vdo.ServerReminderTime = DateTime.Now; vdo.DateAdded = DateTime.Now; dc.Videos.AddObject(vdo); dc.SaveChanges(); EmailService.NewUserRegister(usr, vdo.VideoId); return usr; }
private void ClearBadVideos() { Videos vids = new Videos(); vids.GetAll(); foreach (Video vv1 in vids) { if (vv1.IsEnabled) { bool? sss = Utilities.GETRequest(new Uri( string.Format("http://i3.ytimg.com/vi/{0}/1.jpg", vv1.ProviderKey)), true); if (sss == null) continue; if (!Convert.ToBoolean(sss)) { vv1.IsEnabled = false; vv1.Update(); } } } }
/* * public void RemoveMatches(Predicate<Video> match) * { * foreach (Video v in this.Videos * Videos.Where(match); * }*/ public void Clear() { Videos.Clear(); }
protected void Page_Load(object sender, EventArgs e) { try { Response.Cache.SetExpires(DateTime.Now); StateManager objStateManager = StateManager.Instance; //fetching values from session GetValuesFromSession(); Tributes objTrb = new Tributes(); Tributes objTrbForLinkMem = new Tributes(); Videos objVideos = new Videos(); HeaderHome.Visible = false; divEditButton.Visible = false; dvUploadPhoto.Visible = false; divLearnMore.Visible = false; divViewMemorialTribute.Visible = false; divOrderDVD.Visible = false; divHeaderUC.Visible = false; lblDate1.Visible = false; lblAge.Visible = false; SetControlsValue(); //url check if ((Request.QueryString["tributeId"] != null) && (int.TryParse(Request.QueryString["tributeId"].ToString(), out _tributeId))) { // For passing in Create Tribute Button of Modal Popup Session["TributeId"] = _tributeId.ToString(); packageId = _presenter.GetTributePackageId(_tributeId); //LHK: Check for expiry message string tributeEndDate = _presenter.GetTributeEndDate(_tributeId); #region if loop if (tributeEndDate != "") { string errorHtml = string.Empty; if (!tributeEndDate.Equals("Never")) { DateTime dt1 = DateTime.Now; DateTime.TryParseExact(tributeEndDate, "MM'/'dd'/'yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt1); if (dt1 > DateTime.Now) { VideoExpiryDate = dt1.ToString("dd/MM/yyyy"); if (WebConfig.ApplicationMode.Equals("local")) { errorHtml = "<img src='../assets/images/warn.png'/> The video can be viewed until<b> " + dt1.ToString("MMMM dd, yyyy") + "</b>. To keep it online longer, <a href='" + Session["APP_PATH"].ToString() + "tribute/videotributesponsor.aspx?tributeId=" + _tributeId + "' style='font-weight:bold'>click here to upgrade</a>"; } else { errorHtml = "<img src='../assets/images/warn.png'/> The video can be viewed until <b> " + dt1.ToString("MMMM dd, yyyy") + "</b>. To keep it online longer, <a href='http://video." + WebConfig.TopLevelDomain + "/tribute/videotributesponsor.aspx?tributeId=" + _tributeId + "' style='font-weight:bold'>click here to upgrade</a>"; } } else { VideoExpiryDate = dt1.ToString("dd/MM/yyyy"); if (WebConfig.ApplicationMode.Equals("local")) { errorHtml = "<img src='../assets/images/error_pic.png'/> This video has expired. To reactivate the video so that it can be viewed for life. <a href='" + Session["APP_PATH"].ToString() + "tribute/videotributesponsor.aspx?tributeId=" + _tributeId + "'style='color:Red;font-weight:bold' >click here to upgrade</a>"; } else { errorHtml = "<img src='../assets/images/error_pic.png'/> This video has expired. To reactivate the video so that it can be viewed for life. <a href='http://video." + WebConfig.TopLevelDomain + "/tribute/videotributesponsor.aspx?tributeId=" + _tributeId + "'style='color:Red;font-weight:bold' >click here to upgrade</a>"; } } } else { VideoExpiryDate = null; errorHtml = "<img src='../assets/images/warn.png'/> This video has been upgraded and can be viewed forever!"; } if (packageId == 1 || packageId == 2 || packageId == 9 || packageId == 10) { lblErrorMessage.Text = errorHtml; } else { lblVidOnlyErrorMessage.Text = errorHtml; } } #endregion #region HeaderHome //HeaderHome visible for logged in user if (_userId > 0) { HeaderHome.Visible = true; } #endregion //fetching Tribute Details on TributeId objTrb = _presenter.GetTributeFieldDetails(_tributeId); #region loop for video tribute if (objTrb != null) { if (objTrb.TributeType == 8) { //fetching Video Details on tributeId _tributeType = "Video"; objVideos = _presenter.GetVideoDetailsOnUserTributeId(_tributeId); //for Link mem tribute id _presenter.GetLinkVideoMemorialTribute(_userId, _tributeId); //check VideoFile mapping wrt to tributeId. (video url contains fileName) #region ifloopAdmin check if (objVideos != null) { if (objVideos.TributeVideoId != null) { if (_userId == _videoUserId) { isAdmin = true; } //objTrbForLinkMem = _presenter.GetDetailOfLinkedtribute(Convert.ToInt32(_linkMemTributeId.ToString())); //Session["TributeURlofLinkMemTrb"] = objTrbForLinkMem.TributeUrl.ToString(); } } #endregion if (_linkMemTributeId > 0) { objTrbForLinkMem = _presenter.GetDetailOfLinkedtribute(Convert.ToInt32(_linkMemTributeId.ToString())); if (objTrbForLinkMem != null) Session["TributeURlofLinkMemTrb"] = objTrbForLinkMem.TributeUrl.ToString(); } //if (objTrb.TributeType.Equals(8)) //{ //fetching Video Details on tributeId objVideos = _presenter.GetVideoDetailsOnUserTributeId(_tributeId); //check VideoFile mapping wrt to tributeId. (video url contains fileName) #region if loop3 if (objVideos != null) { if (objVideos.TributeVideoId != null) { if (_userId == 0) { // TributeCustomHeader.Visible = false; divHeaderUC.Visible = false; _userId = _userTributeId; } lblMailforDVD.Text = "<a href='mailto:" + TributeUserEmail.ToString() + "?subject=Request to order Video Tribute on DVD'>Email funeral home to order a DVD</a> "; //LHK: 7/1/2011 -check for private removed if (_isPrivate) ShowVideo(); //AG: Added for visit count if (_tributeId > 0) { this._presenter.AddTributeCount(_tributeId); } Users objUsers = _presenter.GetUserNameOnUserId(_userId); TributeCustomHeader.UserName = objUsers.UserName.ToString(); GetHeaderDetailsOnUserId(_userId); if (IsCustomHeaderOn == true) { TributeCustomHeader.Visible = true; //EmptyDivAboveMainPanel.Visible = false; //LHK:7/1/2011-revomed TributeCustomHeader } else { TributeCustomHeader.Visible = false; divHeaderUC.Visible = false; if (!_isUserLoggedIn) { //LHK: to add a blank div for saparation between header and page body. //EmptyDivAboveMainPanel.Visible = true; } } if (!this.IsPostBack) { try { this._presenter.OnViewInitialized(); } catch (Exception ex) { throw ex; } } this._presenter.OnViewLoaded(); SetControlsVisibility(); } else { Response.Redirect("~/Errors/Error404.aspx", false); } } else { Response.Redirect("~/Errors/Error404.aspx", false); } #endregion } } else { Response.Redirect("~/Errors/Error404.aspx", false); } #endregion //AG: Added new folder name string folderName = this._presenter.GetExistingFolderName(_tributeId); //body.Attributes.Add("onload", "Themer('" + themeValue + "');"); string appPath = string.Empty; if (WebConfig.ApplicationMode.ToLower().Equals("local")) { appPath = WebConfig.AppBaseDomain; } else { appPath = string.Format("{0}{1}{2}", "http://www.", WebConfig.TopLevelDomain, "/"); } idSheet.Attributes.Add("href", appPath + "assets/themes/" + folderName + "/theme.css"); //to set the selected theme } else { Response.Redirect("~/Errors/Error404.aspx", false); } //LHK:EmptyDivAboveMainPanel StateManager stateMngr = StateManager.Instance; SessionValue objSessvalue = (SessionValue)stateMngr.Get("objSessionvalue", StateManager.State.Session); if (_tributeUrl != null) { GetCustomHeaderVisible(_tributeUrl, WebConfig.ApplicationType.ToString()); } if (!(objSessvalue != null)) { if (!IsCstmHeaderOn) { EmptyDivAboveMainPanel.Visible = true; } } //LHK:EmptyDivAboveMainPanel if (_tributeName != null) Page.Title = _tributeName + " | " + _tributeType + " Tribute"; } catch (Exception ex) { //throw ex; Response.Redirect("~/Errors/Error404.aspx", false); } }
private void GetUserAccountVideos() { if (_ua.UserAccountID <= 0) return; var uavs = new UserAccountVideos(); uavs.GetRecentUserAccountVideos(_ua.UserAccountID, 'F'); if (uavs.Count <= 0) return; var favvids = new Videos(); favvids.AddRange(uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f1 => f1.IsEnabled)); var sngrcds2 = new SongRecords(); sngrcds2.AddRange(favvids.Select(v1 => new SongRecord(v1))); sngrcds2.IsUserSelected = true; ViewBag.UserFavorites = sngrcds2.VideosList(); }
public ActionResult Playlist() { ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277; ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400; if (_mu != null) _ua = new UserAccount(Convert.ToInt32(_mu.ProviderUserKey)); ViewBag.UserName = _ua.UserName; var plyst = new Playlist(); plyst.GetUserPlaylist(_ua.UserAccountID); ViewBag.AutoPlay = plyst.AutoPlay; ViewBag.AutoPlayNumber = (plyst.AutoPlay) ? 1 : 0; ViewBag.UserPlaylistID = plyst.PlaylistID; var plyvids = new PlaylistVideos(); plyvids.GetPlaylistVideosForPlaylist(plyst.PlaylistID); var vids = new Videos(); vids.AddRange(plyvids.Select(plv => new Video(plv.VideoID))); var sngrcs = new SongRecords(); sngrcs.AddRange(vids.Select(vi => new SongRecord(vi))); ViewBag.PlaylistVideos = sngrcs.VideoPlaylist(); return View(); }
public async Task InitializeRelatedVideos() { if (!HasVideoDescription) { return; } using (var releaser = await _InitializeLock.LockAsync()) { if (_IsInitialized) { return; } // ニコスクリプトで指定されたジャンプ先動画 if (_JumpVideoId != null) { var video = await NicoVideoProvider.GetNicoVideoInfo(_JumpVideoId, requireLatest : true); if (video != null) { JumpVideo = new VideoInfoControlViewModel(video); RaisePropertyChanged(nameof(JumpVideo)); } } // 再生中アイテムのタイトルと投稿者説明文に含まれる動画IDの動画タイトルを比較して // タイトル文字列が近似する動画をシリーズ動画として取り込む // 違うっぽい動画も投稿者が提示したい動画として確保 var sourceVideo = Database.NicoVideoDb.Get(CurrentVideoId); var videoIds = _VideoViewerHelpInfo.GetVideoIds(); List <Database.NicoVideo> seriesVideos = new List <Database.NicoVideo>(); seriesVideos.Add(sourceVideo); foreach (var id in videoIds) { var video = await NicoVideoProvider.GetNicoVideoInfo(id, requireLatest : true); var titleSimilarity = sourceVideo.Title.CalculateSimilarity(video.Title); if (titleSimilarity > _SeriesVideosTitleSimilarityValue) { seriesVideos.Add(video); } else { var otherVideo = new VideoInfoControlViewModel(video); OtherVideos.Add(otherVideo); } } // シリーズ動画として集めたアイテムを投稿日が新しいものが最後尾になるよう並び替え // シリーズ動画に番兵として仕込んだ現在再生中のアイテムの位置と動画数を比べて // 動画数が上回っていた場合は次動画が最後尾にあると決め打ちで取得する var orderedSeriesVideos = seriesVideos.OrderBy(x => x.PostedAt).ToList(); var currentVideoIndex = orderedSeriesVideos.IndexOf(sourceVideo); if (orderedSeriesVideos.Count - 1 > currentVideoIndex) { var nextVideo = orderedSeriesVideos.Last(); NextVideo = new VideoInfoControlViewModel(nextVideo); orderedSeriesVideos.Remove(nextVideo); RaisePropertyChanged(nameof(NextVideo)); } // 次動画を除いてシリーズ動画っぽいアイテムを投稿者が提示したい動画として優先表示されるようにする orderedSeriesVideos.Remove(sourceVideo); orderedSeriesVideos.Reverse(); foreach (var video in orderedSeriesVideos) { var videoVM = new VideoInfoControlViewModel(video); OtherVideos.Insert(0, videoVM); } RaisePropertyChanged(nameof(OtherVideos)); // チャンネル動画で次動画が見つからなかった場合は // チャンネル動画一覧から次動画をサジェストする if (sourceVideo.Owner.UserType == Mntone.Nico2.Videos.Thumbnail.UserType.Channel && NextVideo == null ) { // DBからチャンネル情報を取得 var db_channelInfo = Database.NicoChannelInfoDb.GetFromRawId(sourceVideo.Owner.OwnerId); if (db_channelInfo == null) { db_channelInfo = new Database.NicoChannelInfo() { RawId = sourceVideo.Owner.OwnerId, ThumbnailUrl = sourceVideo.Owner.IconUrl, Name = sourceVideo.Owner.ScreenName }; } // チャンネル動画の一覧を取得する // ページアクセスが必要なので先頭ページを取って // 全体の分量を把握してから全ページ取得を行う List <ChannelVideoInfo> channelVideos = new List <ChannelVideoInfo>(); var channelVideosFirstPage = await ChannelProvider.GetChannelVideo(sourceVideo.Owner.OwnerId, 0); var uncheckedCount = channelVideosFirstPage.TotalCount - channelVideosFirstPage.Videos.Count; if (channelVideosFirstPage.TotalCount != 0) { channelVideos.AddRange(channelVideosFirstPage.Videos); var uncheckedPageCount = (int)Math.Ceiling((double)uncheckedCount / 20); /* チャンネル動画1ページ = 20 動画 */ foreach (var page in Enumerable.Range(1, uncheckedPageCount)) { var channelVideoInfo = await ChannelProvider.GetChannelVideo(sourceVideo.Owner.OwnerId, page); channelVideos.AddRange(channelVideoInfo.Videos); } db_channelInfo.Videos = channelVideos; } Database.NicoChannelInfoDb.AddOrUpdate(db_channelInfo); var collectionView = new AdvancedCollectionView(db_channelInfo.Videos); collectionView.SortDescriptions.Add(new SortDescription(nameof(ChannelVideoInfo.PostedAt), SortDirection.Ascending)); collectionView.SortDescriptions.Add(new SortDescription(nameof(ChannelVideoInfo.ItemId), SortDirection.Ascending)); collectionView.RefreshSorting(); var item = collectionView.FirstOrDefault(x => (x as ChannelVideoInfo).Title == sourceVideo.Title); var pos = collectionView.IndexOf(item); if (pos >= 0) { var nextVideo = collectionView.ElementAtOrDefault(pos + 1) as ChannelVideoInfo; if (nextVideo != null) { var videoVM = new ChannelVideoListItemViewModel(nextVideo.ItemId); videoVM.IsRequirePayment = nextVideo.IsRequirePayment; videoVM.SetTitle(nextVideo.Title); videoVM.SetSubmitDate(nextVideo.PostedAt); videoVM.SetThumbnailImage(nextVideo.ThumbnailUrl); videoVM.SetVideoDuration(nextVideo.Length); videoVM.SetDescription(nextVideo.ViewCount, nextVideo.CommentCount, nextVideo.MylistCount); NextVideo = videoVM; RaisePropertyChanged(nameof(NextVideo)); } } } // マイリスト var relatedMylistIds = _VideoViewerHelpInfo.GetMylistIds(); foreach (var mylistId in relatedMylistIds) { var mylistDetails = await MylistProvider.GetMylistGroupDetail(mylistId); if (mylistDetails.IsOK) { Mylists.Add(new MylistGroupListItem(mylistDetails.MylistGroup)); } } RaisePropertyChanged(nameof(Mylists)); var videos = await Video.GetRelatedVideos(CurrentVideoId); Videos = videos.Select(x => { var vm = new VideoInfoControlViewModel(x); return(vm); }) .ToList(); CurrentVideo = Videos.FirstOrDefault(x => x.RawVideoId == CurrentVideoId); RaisePropertyChanged(nameof(Videos)); RaisePropertyChanged(nameof(CurrentVideo)); _IsInitialized = true; } }
public bool Contains(Video video) { return(Videos.Contains(video)); }
private void LoadMedia() { Photos = BinaryCipher.FromFile(ImagesFile); Videos = BinaryCipher.VideosFromFile(VideosTumb); }
private async void ResolveDomains_Click(object sender, EventArgs e) { var results = new List <(string, string)>(); var results404 = new List <(string, string)>(); await Task.Run(async() => { foreach (var line in Domains.Lines) { foreach (var video in Videos) { var desc = video.DisplayDescription; if (desc.IndexOf(line, StringComparison.InvariantCultureIgnoreCase) != -1) { var matches = Regex.Matches(desc, $@"(https?:\/\/)?(w{3}\.)?{Regex.Escape(line)}(\S+)?"); foreach (Match match in matches) { if (results.Any(x => x.Item1.Equals(match.Value)) || results404.Any(x => x.Item1.Equals(match.Value))) { continue; } HttpWebRequest request = (HttpWebRequest)(WebRequest.Create(match.Value)); try { using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync()) { string uriString = response.ResponseUri.AbsoluteUri; results.Add((match.Value, uriString)); LogMessage($"Resolved: {match.Value} to {uriString}"); } } catch (WebException we) { HttpWebResponse errorResponse = we.Response as HttpWebResponse; if (errorResponse.StatusCode == HttpStatusCode.NotFound) { LogMessage($"404 Error for: {match.Value} Resolved to: {we.Response.ResponseUri.AbsoluteUri}"); results404.Add((match.Value, we.Response.ResponseUri.AbsoluteUri)); } else { LogMessage($"Web error for: {match.Value} {errorResponse.StatusCode}"); } } } } } } }); LogMessage("Finished resolving domains."); var result = MessageBox.Show("Would you like to replace these domains with their resolved values?", "This will be applied when you choose to update descriptions by pressing the \"Update Video Descriptions\" button. Note: if their are 404 domains another message box will be displayed asking for input on that.", MessageBoxButtons.YesNo); var replace404 = new List <(string, string)>(); if (results404.Any()) { MessageBox.Show("There were 404 results detected, please select whether you would like to replace the shortlinks with their resolved values."); foreach (var tuple in results404) { var response = MessageBox.Show($"Would you like to replace {tuple.Item1} with {tuple.Item2} ?", "", MessageBoxButtons.YesNo); if (response != DialogResult.Yes) { replace404.Add(tuple); } } } if (result == DialogResult.Yes) { foreach (var video in Videos) { foreach (var resolve in results) { video.DisplayDescription = video.DisplayDescription.Replace(resolve.Item1, resolve.Item2, true).Item2; } foreach (var result404 in replace404) { video.DisplayDescription = video.DisplayDescription.Replace(result404.Item1, result404.Item2, true).Item2; } } VideoInformation.Text = NewLineFix(string.Join("\r\n----------\r\n", Videos.Select(x => $"Title: {x.Video.Snippet.Title} ({x.Video.Id})\r\n----------\r\n{x.DisplayDescription}"))); } UpdateDescriptionTextChange(); }
private async void UpdateDescriptions_Click(object sender, EventArgs e) { UpdateDescriptions.Enabled = false; var transforms = Transformations.Select(x => new TrackedTransformation { Method = x }).ToArray(); int updatedVideos = 0; int softError = 0; int index = 0; bool hardError = false; int updatable = Videos.Count(x => x.DiscriptionChanged); foreach (var video in Videos) { index++; if (!video.DiscriptionChanged) { continue; } try { updatedVideos++; await Uploads.UpdateDescription(video.Video, video.DisplayDescription); } catch (Exception ex) { LogMessage(ex.ToString()); if (ex is Google.GoogleApiException gEx) { LogMessage($"{gEx.Error} on video: {video.Video.Snippet.Title} ({video.Video.Id})"); if (gEx.Error.Code == 400) { softError++; } else { hardError = true; break; } } } UpdateProgress.Value = (int)(((double)index / Videos.Count) * 100); ProgressText.Text = $"{index}/{Videos.Count} Videos Checked. {updatedVideos}/{updatable} Updated. {softError} Issues detected."; } UpdateProgress.Value = 100; if (!hardError) { ProgressText.Text = $"{Videos.Count}/{Videos.Count} Videos Checked. {updatedVideos}/{updatable} Updated. {softError} Issues detected."; } else { ProgressText.Text = $"{Videos.Count}/{Videos.Count} Videos Checked. {updatedVideos}/{updatable} Updated. {softError} Issues detected. Fatal Error Encountered."; } var response = $"Updated {updatedVideos} videos\r\n"; foreach (var transform in transforms) { if (transform.Method.Method == AdditionalMethods.StringTransformation.TransformationMethod.Replace) { response += $"Replaced {transform.TransformCount} occurrences of {transform.Method.PrimaryValue} with {transform.Method.SecondaryValue}\r\n"; } else if (transform.Method.Method == AdditionalMethods.StringTransformation.TransformationMethod.Remove) { response += $"Removed {transform.TransformCount} occurrences of {transform.Method.PrimaryValue}\r\n"; } } VideoInformation.Text = NewLineFix(string.Join("\r\n----------\r\n", Videos.Select(x => $"Title: {x.Video.Snippet.Title} ({x.Video.Id})\r\n----------\r\n{x.DisplayDescription}"))); LogMessage("Descriptions update."); LogMessage(response); UpdateDescriptions.Enabled = true; BackupVideos("Update"); }
public void UpdateDescriptionTextChange() { UpdateDescriptions.Text = $"Update {Videos.Count(x => x.DiscriptionChanged)} Videos"; UpdateDescriptions.Enabled = true; }
public void RemoveIndex(int index) { Videos.RemoveAt(index); }
public bool RemoveVideo(Video video) { return(Videos.Remove(video)); }
public void Put(Videos video) { }
public bool IsNew(string id) { return(Videos.Any(video => video.VideoId == id && video.Status == VideoStatus.New)); }
public AddVideoModel(IVideoData addVideo, IWebHostEnvironment webHostEnvironment) { this.addVideo = addVideo; this.webHostEnvironment = webHostEnvironment; VideoDetails = new Videos(); }
void backgroundWorkerNewsFeed_DoWork(object sender, DoWorkEventArgs e) { try { if (e != null) { if (e.Cancel) { return; } } dynamic parameters = new ExpandoObject(); if (!IsInitialFetch && LastUpdate != null) { // danach kamen keine Updates mehr durch :( // parameters.since = GetUnixTimestamp(LastUpdate).ToString(); } string[] feeds = { "home", "feed" }; foreach (string feedName in feeds) { dynamic result = facebookClient.Get("/me/" + feedName, parameters); // Home if (result != null) { foreach (dynamic post in result.data) { if (e != null) { if (e.Cancel) { return; } } FacebookItem item = FacebookItem.ConvertResponseToItem(post, this); if (item == null) { AppController.Current.Logger.writeToLogfile("Null item in facebook retrieval"); continue; } FacebookItem ExistingItem = null; try { switch (item.MessageType) { case FacebookItem.MessageTypes.Link: if (Links.Where(oldItem => oldItem.fullId == item.fullId).Count() > 0) { ExistingItem = Links.Where(oldItem => oldItem.fullId == item.fullId).First(); } break; case FacebookItem.MessageTypes.Video: if (Videos.Where(oldItem => oldItem.fullId == item.fullId).Count() > 0) { ExistingItem = Videos.Where(oldItem => oldItem.fullId == item.fullId).First(); } break; case FacebookItem.MessageTypes.Photo: if (Photos.Where(oldItem => oldItem.fullId == item.fullId).Count() > 0) { ExistingItem = Photos.Where(oldItem => oldItem.fullId == item.fullId).First(); } break; case FacebookItem.MessageTypes.Note: if (Notes.Where(oldItem => oldItem.fullId == item.fullId).Count() > 0) { ExistingItem = Notes.Where(oldItem => oldItem.fullId == item.fullId).First(); } break; case FacebookItem.MessageTypes.Event: if (Events.Where(oldItem => oldItem.fullId == item.fullId).Count() > 0) { ExistingItem = Events.Where(oldItem => oldItem.fullId == item.fullId).First(); } break; case FacebookItem.MessageTypes.CheckIn: if (CheckIns.Where(oldItem => oldItem.fullId == item.fullId).Count() > 0) { ExistingItem = CheckIns.Where(oldItem => oldItem.fullId == item.fullId).First(); } break; default: if (StatusMessages.Where(oldItem => oldItem.fullId == item.fullId).Count() > 0) { ExistingItem = StatusMessages.Where(oldItem => oldItem.fullId == item.fullId).First(); } break; } } catch { ExistingItem = null; } if (ExistingItem == null) { try { dynamic comments = facebookClient.Get("/" + item.fullId + "/comments", parameters); item.Comments.Clear(); if (comments != null) { if (comments.data != null) { AppController.Current.Logger.writeToLogfile("Facebook item has comments/data"); foreach (dynamic fbcomment in comments.data) { AppController.Current.Logger.writeToLogfile("Reading comment"); FacebookComment comment = new FacebookComment(fbcomment); comment.Account = item.Account; if (comment.User.Id == this.Id.ToString()) { item.isCommented = true; } item.Comments.Add(comment); } } } } catch { } item.ReceivingAccount = this; backgroundWorkerNewsFeed.ReportProgress(100, item); continue; } else { if (item.LikesCount != ExistingItem.LikesCount) { item.HasUpdatedLikes = true; } List <FacebookComment> updatedComments = new List <FacebookComment>(); foreach (FacebookComment comment in item.Comments) { if (e != null) { if (e.Cancel) { return; } } if (ExistingItem.Comments.Where(c => c.Text == comment.Text && c.User.Id == comment.User.Id).Count() == 0) { updatedComments.Add(comment); } } if (updatedComments.Count > 0) { item.HasUpdatedComments = true; item.Comments.Clear(); foreach (FacebookComment comment in updatedComments) { item.Comments.Add(comment); } } if (item.HasUpdatedComments || item.HasUpdatedLikes) { item.ReceivingAccount = this; backgroundWorkerNewsFeed.ReportProgress(100, item); } else { item = null; } } } } } } catch (FacebookOAuthException oauthExp) { AppController.Current.Logger.writeToLogfile(oauthExp); } catch (Exception exp) { AppController.Current.Logger.writeToLogfile(exp);; } }
protected static string GetVideo(Videos videos) { return("https://www.youtube.com/embed/" + videos.results.First().key); }
public ActionResult Index() { // CONTESTS Contest cndss = Contest.GetCurrentContest(); ContestVideos cvids = new ContestVideos(); Videos vidsInContest = new Videos(); BootBaronLib.AppSpec.DasKlub.BOL.Video vid2 = null; foreach (ContestVideo cv1 in cvids) { vid2 = new BootBaronLib.AppSpec.DasKlub.BOL.Video(cv1.VideoID); vidsInContest.Add(vid2); } vidsInContest.Sort(delegate(BootBaronLib.AppSpec.DasKlub.BOL.Video p1, BootBaronLib.AppSpec.DasKlub.BOL.Video p2) { return p2.PublishDate.CompareTo(p1.PublishDate); }); SongRecords sngrcds3 = new SongRecords(); SongRecord sng3 = new SongRecord(); foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in vidsInContest) { sng3 = new SongRecord(v1); sngrcds3.Add(sng3); } ViewBag.ContestVideoList = sngrcds3.VideosList(); ViewBag.CurrentContest = cndss; // PhotoItems pitms = new PhotoItems(); pitms.UseThumb = true; pitms.ShowTitle = false; pitms.GetPhotoItemsPageWise(1, 4); ViewBag.PhotoList = pitms.ToUnorderdList; Contents cnts = new Contents(); cnts.GetContentPageWiseAll(1, 3); ViewBag.RecentArticles = cnts.ToUnorderdList; UserAccounts uas = new UserAccounts(); uas.GetNewestUsers(); ViewBag.NewestUsers = uas.ToUnorderdList; Videos newestVideos = new Videos(); newestVideos.GetMostRecentVideos(); SongRecords newSongs = new SongRecords(); SongRecord sng1 = null; foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in newestVideos) { sng1 = new SongRecord(v1); newSongs.Add(sng1); } ViewBag.NewestVideos = newSongs.VideosList(); BootBaronLib.AppSpec.DasKlub.BOL.Video vid = new BootBaronLib.AppSpec.DasKlub.BOL.Video(BootBaronLib.AppSpec.DasKlub.BOL.Video.RandomVideoIDVideo()); ViewBag.RandomVideoKey = vid.ProviderKey; ///video submit MultiProperties addList = null; PropertyType propTyp = null; MultiProperties mps = null; // video typesa propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); ViewBag.VideoTypes = mps; // person types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); ViewBag.PersonTypes = mps; //// footage types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); addList = new MultiProperties(); ViewBag.FootageTypes = mps; return View(); }
public JsonResult Items(int pageNumber) { videoPageNumber = pageNumber; toShow = new BootBaronLib.AppSpec.DasKlub.BOL.Videos(); LoadFilteredVideos(true); SongRecords sngrcs = new SongRecords(); SongRecord sngrcd = null; foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video vi in toShow) { sngrcd = new SongRecord(vi); sngrcs.Add(sngrcd); } sngrcs.IncludeStateAndEndTag = false; return Json(new { ListItems = sngrcs.VideosPageList() }); }
private Videos LoadNewestVideos() { var vids = new Videos(); vids.GetMostRecentVideos(); return vids; }
public ActionResult VideoPreview(int id) { Videos video = db.Videos.Find(id); return(View(video)); }
public Videos.Get.Result Get(Int32? page, Int32? per_page, String query, Videos.Get.Command.SortValues sort, Videos.Get.Command.DirectionValues direction, Videos.Get.Command.FilterValues filter) { var cm = new Videos.Get.Command(); cm.page = page; cm.per_page = per_page; cm.query = query; cm.sort = sort; cm.direction = direction; cm.filter = filter; return this.Get(cm); }
/// <summary> /// Method to save Video Tribute /// </summary> /// <param name="objVideo">Filled Video Entity</param> /// <returns>Video Id</returns> public void SaveVideoTribute(Videos objVideo) { FacadeManager.VideoManager.SaveVideo(objVideo, "VideoTribute"); }
public ActionResult VideoVote() { Contest contest = Contest.GetLastContest(); ViewBag.Contest = contest; mu = Membership.GetUser(); if (ContestVideo.IsUserContestVoted(Convert.ToInt32(mu.ProviderUserKey), contest.ContestID) && contest.DeadLine.AddHours(72) > DateTime.UtcNow) { LoadContestResults(); return View(); } ContestVideos cvids = new ContestVideos(); cvids.GetContestVideosForContest(contest.ContestID); Videos vidsInContest = new Videos(); Video vid2 = null; foreach (ContestVideo cv1 in cvids) { vid2 = new Video(cv1.VideoID); vidsInContest.Add(vid2); } vidsInContest.Sort(delegate(Video p1, Video p2) { return p1.PublishDate.CompareTo(p2.PublishDate); }); ViewBag.ContestVideos = vidsInContest; //SongRecords sngrcds3 = new SongRecords(); //SongRecord sng3 = new SongRecord(); //foreach (Video v1 in vidsInContest) //{ // sng3 = new SongRecord(v1); // sngrcds3.Add(sng3); //} //ViewBag.ContestVideoList = sngrcds3.VideosList(); return View(); }
public void SaveVideoTributeAndSendEmail(Videos objVideo) { FacadeManager.VideoManager.SaveVideoTributeAndSendEmail(objVideo, "VideoTribute"); }
/// <summary> /// Method to delete video tribute based on tribute id. /// </summary> /// <param name="objVideo">Video entity containing tribute Id</param> public void DeleteVideoTribute(Videos objVideo) { FacadeManager.VideoManager.DeleteVideoTribute(objVideo); }
public void AddFile(ISingleFile file) { VideoFiles.Add(file); Videos.Add(file.VideoFileName); }
public void Post([FromBody] Videos video) { _apiContext.Videos.Add(video); _apiContext.SaveChanges(); }
public void RemoveFile(ISingleFile file) { VideoFiles.Remove(file); Videos.Remove(file.VideoFileName); }
public void Delete(Videos video) { }
internal void Read(EndianBinaryReader reader) { Name = reader.ReadStringOffset(StringBinaryFormat.NullTerminated); StartFrame = reader.ReadSingle(); EndFrame = reader.ReadSingle(); FrameRate = reader.ReadSingle(); BackgroundColor = reader.ReadColor(VectorBinaryFormat.UInt8); Width = reader.ReadInt32(); Height = reader.ReadInt32(); long cameraOffset = reader.ReadOffset(); int compositionCount = reader.ReadInt32(); long compositionsOffset = reader.ReadOffset(); int videoCount = reader.ReadInt32(); long videosOffset = reader.ReadOffset(); int audioCount = reader.ReadInt32(); long audiosOffset = reader.ReadOffset(); reader.ReadAtOffset(cameraOffset, () => { Camera = new Camera(); Camera.Read(reader); }); reader.ReadAtOffset(compositionsOffset, () => { Compositions.Capacity = compositionCount; for (int i = 0; i < compositionCount; i++) { var composition = new Composition(); composition.Read(reader); Compositions.Add(composition); } }); reader.ReadAtOffset(videosOffset, () => { Videos.Capacity = videoCount; for (int i = 0; i < videoCount; i++) { var video = new Video(); video.Read(reader); Videos.Add(video); } }); reader.ReadAtOffset(audiosOffset, () => { Audios.Capacity = audioCount; for (int i = 0; i < audioCount; i++) { var audio = new Audio(); audio.Read(reader); Audios.Add(audio); } }); foreach (var composition in Compositions) { foreach (var layer in composition.Layers) { layer.ResolveReferences(composition, this); } } }
public bool IsTemporary(string id) { return(Videos.Any(video => video.VideoId == id)); }
public List <Video> GetVideosByMedia(int idApostila, int idDataMatrix) { using (var ctx = new AcademicoContext()) { using (var ctxMatDir = new DesenvContext()) { List <int?> videoIds = (( from m in ctxMatDir.tblMedcode_DataMatrix join mtp in ctxMatDir.tblMedcode_DataMatrix_Tipo on m.intMediaTipo equals mtp.intMediaTipoID join vb in ctxMatDir.tblVideo_Book on m.txtMediaCode equals vb.txtVideoCode where m.intDataMatrixID == idDataMatrix && vb.intBookID == idApostila && m.intBookID == idApostila && (mtp.intMediaTipoID == (int)Media.Tipo.VideoECG || mtp.intMediaTipoID == (int)Media.Tipo.VideoApostila || mtp.intMediaTipoID == (int)Media.Tipo.MEDi) select vb.intVideoID ).Union( from m in ctxMatDir.tblMedcode_DataMatrix join mtp in ctxMatDir.tblMedcode_DataMatrix_Tipo on m.intMediaTipo equals mtp.intMediaTipoID join q in ctxMatDir.tblVideo_Questao_Concurso on m.intMediaID equals q.intQuestaoID where m.intDataMatrixID == idDataMatrix && mtp.intMediaTipoID == (int)Media.Tipo.VideoQuestão select(int?) q.intVideoID) ).ToList(); var consulta = ( from v in ctx.tblVideo where videoIds.Contains(v.intVideoID) select new { v.intVideoID, v.txtName, v.txtPath, v.txtFileName }); var lst = new Videos(); foreach (var valor in consulta) { var v = new Video { ID = valor.intVideoID, Url = GetUrlVideoPorVideoID(valor.intVideoID, _chaveamentoVimeoQuestao) }; if (valor.txtPath.ToLower().Contains("bitsontherun")) { v.Thumb = String.Concat(valor.txtPath.Replace("jwp/", "").Trim(), "thumbs/", valor.txtFileName.Replace(".xml", "").Trim(), "-240.jpg"); } else { v.Thumb = Constants.URLTHUMBVIDEO.Replace("IDVIDEO", valor.intVideoID.ToString()).Replace("FORMATO", "cellthumb"); } //v.Thumb = Constants.URLCOMENTARIOIMAGEM.Replace("IDCOMENTARIOIMAGEM", valor.intVideoID.ToString()).Replace("FORMATO", "cellthumb"); //v.Thumb = Constants.URLTHUMBVIDEO.Replace("IDVIDEO", v.ID.ToString()); lst.Add(v); } return(lst); } } }
void backgroundWorkerNewsFeed_ProgressChanged(object sender, ProgressChangedEventArgs e) { FacebookItem item = (FacebookItem)e.UserState; if (item == null) { return; } string notificationClassName = "Facebook " + FullName + " "; if (item.HasUpdatedLikes || item.HasUpdatedComments) { FacebookItem ExistingItem = null; try { switch (item.MessageType) { case FacebookItem.MessageTypes.Link: ExistingItem = Links.Where(oldItem => oldItem.fullId == item.fullId).First(); break; case FacebookItem.MessageTypes.Video: ExistingItem = Videos.Where(oldItem => oldItem.fullId == item.fullId).First(); break; case FacebookItem.MessageTypes.Photo: ExistingItem = Photos.Where(oldItem => oldItem.fullId == item.fullId).First(); break; case FacebookItem.MessageTypes.Note: ExistingItem = Notes.Where(oldItem => oldItem.fullId == item.fullId).First(); break; case FacebookItem.MessageTypes.Event: ExistingItem = Events.Where(oldItem => oldItem.fullId == item.fullId).First(); break; case FacebookItem.MessageTypes.CheckIn: ExistingItem = CheckIns.Where(oldItem => oldItem.fullId == item.fullId).First(); break; default: ExistingItem = StatusMessages.Where(oldItem => oldItem.fullId == item.fullId).First(); break; } if (item.HasUpdatedLikes) { string notificationText = ""; if (!string.IsNullOrWhiteSpace(item.Text)) { notificationText += item.Text.Substring(0, Math.Min(20, item.Text.Length - 1)) + "... "; } else { notificationText += "Facebook item... "; } notificationText += "has new likes"; if (item.isLiked) { AppController.Current.sendNotification(notificationClassName + "Like", notificationText, "The item has " + (item.LikesCount - ExistingItem.LikesCount).ToString() + " new likes", item.User.Avatar, null); } else { AppController.Current.sendNotification(notificationClassName + "Like (on message you didn't comment or like yourself)", notificationText, "The item has " + (item.LikesCount - ExistingItem.LikesCount).ToString() + " new likes", item.User.Avatar, null); } ExistingItem.UpdatedAt = item.UpdatedAt; ExistingItem.LikesCount = item.LikesCount; } if (item.HasUpdatedComments) { foreach (FacebookComment newComment in item.Comments) { if (item.isCommented) { AppController.Current.sendNotification(notificationClassName + "Comment", "New comment on entry of " + ExistingItem.User.FullName, newComment.Text + "\r\nby " + newComment.User.FullName, newComment.User.Avatar, null); } else { AppController.Current.sendNotification(notificationClassName + "Comment (on message you didn't comment or like yourself)", "New comment on entry of " + ExistingItem.User.FullName, newComment.Text + "\r\nby " + newComment.User.FullName, newComment.User.Avatar, null); } ExistingItem.Comments.Add(newComment); ExistingItem.UpdatedAt = item.UpdatedAt; } } } catch (Exception exp) { AppController.Current.Logger.writeToLogfile(exp); } } else { switch (item.MessageType) { case FacebookItem.MessageTypes.Link: Links.Add(item); if (InitialUpdateDoneForLinks) { notificationClassName += "Link"; } break; case FacebookItem.MessageTypes.Video: Videos.Add(item); if (InitialUpdateDoneForVideos) { notificationClassName += "Video"; } break; case FacebookItem.MessageTypes.Photo: Photos.Add(item); if (InitialUpdateDoneForPhotos) { notificationClassName += "Photo"; } break; case FacebookItem.MessageTypes.Note: Notes.Add(item); if (InitialUpdateDoneForNotes) { notificationClassName += "Note"; } break; case FacebookItem.MessageTypes.Event: Events.Add(item); if (InitialUpdateDoneForEvents) { notificationClassName += "Event"; } break; case FacebookItem.MessageTypes.CheckIn: CheckIns.Add(item); if (InitialUpdateDoneForCheckIns) { notificationClassName += "CheckIn"; } break; default: StatusMessages.Add(item); if (InitialUpdateDoneForStatusMessages) { notificationClassName += "Status message"; } break; } if (notificationClassName != "Facebook " + FullName + " ") { AppController.Current.sendNotification(notificationClassName, item.User.FullName, item.Text, item.Avatar, item); } } }
private void Load(string name, TimeSpan?startPosition = null) { SelectedVideo = Videos.FirstOrDefault(v => v.Name == name); StartPosition = startPosition; }
public List <Video> GetByVideoMiolo(VideoMiolo vm, string matricula = null, Aplicacoes IdAplicacao = Aplicacoes.MsProMobile, string VersaoApp = "") { var lstVideosMiolo = new VideosMiolo(); var videos = _vimeoRepository.GetByFilters(vm).ToList(); var chaveamento = new ChaveamentoVimeoMediMiolo(); foreach (var item in videos) { VideoMiolo v = new VideoMiolo() { ID = item.IDApostila.ToString(), VideoID = item.VideoID, IDApostila = item.IDApostila, CodigoVideo = item.CodigoVideo, BorKey = _vimeoRepository.GetBorKey(item.CodigoVideo, item.Ano, item.IDApostila), Qualidade = vm.Qualidade, }; tblVideo video = _vimeoRepository.GetVideoVimeo(null, Convert.ToInt32(item.VideoID)); VideoUrlDTO videoRetorno = new VideoUrlDTO { Url = string.Empty }; var chaveamentoVimeo = chaveamento.GetChaveamento(); if (chaveamentoVimeo) { if ((int)IdAplicacao == (int)Aplicacoes.MEDSOFT_PRO_ELECTRON || (int)IdAplicacao == (int)Aplicacoes.AreaRestrita) { v.URL = video.txtUrlStreamVimeo; } else { v.URL = video.txtUrlVimeo; } } if (video.intVimeoID == null) { ValidarEnvioEmailVideoDefeituoso(video); } else if (v.URL == null) { v.URL = _vimeoRepository.GetUrlPlataformaVideo(video, chaveamentoVimeo, (int)IdAplicacao); if (v.URL == string.Empty) { ValidarEnvioEmailVideoDefeituoso(video); } } v.HTTPURL = v.URL; v.URLThumb = _vimeoRepository.GetUrlThumb(video, new ChaveamentoVimeoMediMiolo(), VersaoApp); v.Links = _vimeoRepository.GetLinksVideoVariasQualidades(video.txtVideoInfo, v.URL); lstVideosMiolo.Add(v); } var lstv = new Videos(); foreach (var valor in lstVideosMiolo) { if (!lstv.Any(i => i.Url.Equals(valor.HTTPURL))) { var video = new Video(); video.ID = Convert.ToInt32(valor.ID); video.VideoId = valor.VideoID; video.Url = valor.HTTPURL; video.Thumb = valor.URLThumb; video.Links = valor.Links; video = _vimeoRepository.CreateVideoObject(video, matricula); lstv.Add(video); } } return(lstv); }
static void Main(string[] args) { var context = new VidzyContext(); //Action movies sorted by name var moviesNameSortedQuery = context.Videos .Where(v => v.Genre.Name == "Action") .OrderBy(v => v.Name) .Select(v => new { MovieName = v.Name }); foreach (var m in moviesNameSortedQuery) { Console.WriteLine(m.MovieName); } Console.WriteLine("=======分割线======="); //Gold drama movies sorted by release date (newest first) var goldDramaQuery = context.Videos .Where(v => v.Classification == Classification.Gold && v.Genre.Name == "Drama") .OrderByDescending(v => v.ReleaseDate) .Select(v => new { MovieName = v.Name }); foreach (var g in goldDramaQuery) { Console.WriteLine(g.MovieName); } Console.WriteLine("=======分割线======="); //All movies projected into an anonymous type with two properties: MovieName and Genre var projectedQuery = context.Videos .Select(v => new { MovieName = v.Name, Genre = v.Genre.Name }); foreach (var p in projectedQuery) { Console.WriteLine(p.MovieName); } Console.WriteLine("=======分割线======="); //All movies grouped by their classification var groupedClassificationQuery = context.Videos .GroupBy(v => v.Classification) .Select(g => new { Classification = g.Key.ToString(), Movies = g.OrderBy(v => v.Name) }); foreach (var g in groupedClassificationQuery) { Console.WriteLine(g.Classification); foreach (var v in g.Movies) { Console.WriteLine("\t" + v.Name); } } Console.WriteLine("=======分割线======="); //List of classifications sorted alphabetically and count of videos in them var classificationsQuery = context.Videos .GroupBy(v => v.Classification) .Select(g => new { Classification = g.Key.ToString(), Count = g.Count() }) .OrderBy(g => g.Classification); foreach (var g in classificationsQuery) { Console.WriteLine(g.Classification + " " + g.Count); } Console.WriteLine("=======分割线======="); //List of genres and number of videos they include, sorted by the numberof videos var genresNumberQuery = context.Genres .GroupJoin(context.Videos, g => g.Id, c => c.GenreId, (Genre, Videos) => new { GenresName = Genre.Name, Count = Videos.Count() }) .OrderByDescending(g => g.Count); foreach (var g in genresNumberQuery) { Console.WriteLine("{0} ({1})", g.GenresName, g.Count); } Console.ReadLine(); }
private static void ClearBadVideos() { var vids = new Videos(); vids.GetAll(); foreach (Video vv1 in from vv1 in vids where vv1.IsEnabled let sss = Utilities.GETRequest(new Uri( string.Format("http://i3.ytimg.com/vi/{0}/1.jpg", vv1.ProviderKey)), true) where sss != null where !Convert.ToBoolean(sss) select vv1) { vv1.IsEnabled = false; vv1.Update(); } }
private void BindPlayer(Videos vdo, string name) { tblVideo.Visible = true; tblPrivate.Visible = false; BindFBComment(vdo.VideoId); IEnumerable<Images> images = ContextHelper.DataContext.Images.Where(o => o.VideoId == vdo.VideoId); if (images.Count() > 0) { Images img = images.OrderByDescending(o => o.DateAdded).First(); string imgUrl = ImageHelper.GetImageUrl(img); (this.Master as TimeFliesMasterPage).ChangeMetaFBImage(imgUrl); } (this.Master as TimeFliesMasterPage).ChangeMetaFBurl("http://" + Settings.IP + "/FriendsVideo.aspx?id=" + vdo.VideoId); (this.Master as TimeFliesMasterPage).ChangeMetaFBTitle("" + name + "'s TimeFlies.by Video"); }
public ActionResult ManageVideos() { var uavs = new UserAccountVideos(); if (_mu != null) uavs.GetVideosForUserAccount(Convert.ToInt32(_mu.ProviderUserKey), 'U'); if (uavs.Count > 0) { var favvids = new Videos(); favvids.AddRange(uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f1 => f1.IsEnabled)); var sngrcds2 = new SongRecords(); sngrcds2.AddRange(favvids.Select(v1 => new SongRecord(v1))); sngrcds2.IsUserSelected = true; sngrcds2.EnableChangeOrder = false; ViewBag.UserUploaded = sngrcds2.VideoPlaylist(); } return View(uavs); }
protected void updateButton_Click(object sender, EventArgs e) { //Database CuriousCamEntities db = new CuriousCamEntities(); //Table Videos c = (from x in db.Videos where x.VideoID == videoID select x).SingleOrDefault(); if (c != null) { c.Title = titleText.Text; c.TopicID = Convert.ToInt32(topicDDList.SelectedValue); c.SubTopicID = Convert.ToInt32(subTopicDDList.SelectedValue); try { if (FileUpload.FileName != "") { if (func.isVideo(FileUpload.FileName) == false) { showMessage("The file you selected must be either of these video formats: mp4, webm, ogv or flv"); return; } if (File.Exists(Server.MapPath("videos/") + c.Path)) { File.Delete(Server.MapPath("videos/") + c.Path); } string newFileName = func.getUserVideoFileName(c.UserID, c.VideoID, FileUpload.FileName); FileUpload.SaveAs(Server.MapPath("/videos/") + newFileName); c.Path = newFileName; string vs = "videos/" + c.Path + "?time=" + DateTime.Now; videoSrc1.Attributes["src"] = vs; videoSrc2.Attributes["src"] = vs; videoSrc3.Attributes["src"] = vs; c.UploadDate = DateTime.Now; } db.SaveChanges(); showMessage("Your video has been successfully apdated..."); } catch (Exception ex) { showMessage("Error:" + ex.ToString()); } } else { showMessage("Video Update: Wrong Video ID:" + videoID.ToString()); } }
public ActionResult VideoVote() { Contest contest = Contest.GetLastContest(); ViewBag.Contest = contest; if (_mu != null && (ContestVideo.IsUserContestVoted(Convert.ToInt32(_mu.ProviderUserKey), contest.ContestID) && contest.DeadLine.AddHours(72) > DateTime.UtcNow)) { LoadContestResults(); return View(); } var cvids = new ContestVideos(); cvids.GetContestVideosForContest(contest.ContestID); var vidsInContest = new Videos(); vidsInContest.AddRange(cvids.Select(cv1 => new Video(cv1.VideoID))); vidsInContest.Sort((p1, p2) => p1.PublishDate.CompareTo(p2.PublishDate)); ViewBag.ContestVideos = vidsInContest; return View(); }
public void GalleryBackButtonPressed() { Images.SetActive(true); Videos.SetActive(false); }
private void GetArtistProfile(Artist art, Videos vids) { // photo var aprop = new ArtistProperty(); aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString()); if (!string.IsNullOrEmpty(aprop.PropertyContent)) { ViewBag.ArtistPhoto = VirtualPathUtility.ToAbsolute(aprop.PropertyContent); ViewBag.ThumbIcon = VirtualPathUtility.ToAbsolute(aprop.PropertyContent); } // meta descriptione aprop = new ArtistProperty(); aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString()); if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.MetaDescription = aprop.PropertyContent; // description aprop = new ArtistProperty(); aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString()); if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.ArtistDescription = ContentLinker.InsertBandLinks(aprop.PropertyContent, false); var sngss = new Songs(); sngss.GetSongsForArtist(art.ArtistID); foreach (Song sn1 in sngss) { vids.GetVideosForSong(sn1.SongID); } }
/// <summary> /// Method to get the video tribute details /// </summary> /// <param name="objVideo">Videos entity containing video id</param> public VideoGallery GetVideoTributeDetails(Videos objVideo) { return FacadeManager.VideoManager.GetVideoTributeDetails(objVideo); }
public ActionResult ProfileDetail(string userName) { ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277; ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400; _ua = new UserAccount(userName); var uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(_ua.UserAccountID); uad.BandsSeen = ContentLinker.InsertBandLinks(uad.BandsSeen, false); uad.BandsToSee = ContentLinker.InsertBandLinks(uad.BandsToSee, false); var model = new ProfileModel(); model.ProfilePhotoMainRaw = uad.RawProfilePicUrl; if (_ua.UserAccountID > 0) { model.UserAccountID = _ua.UserAccountID; model.PhotoCount = PhotoItems.GetPhotoItemCountForUser(_ua.UserAccountID); model.CreateDate = _ua.CreateDate; } if (_mu != null) { ViewBag.IsBlocked = BlockedUser.IsBlockedUser(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey)); ViewBag.IsBlocking = BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID); if (_ua.UserAccountID == Convert.ToInt32(_mu.ProviderUserKey)) { model.IsViewingSelf = true; } else { var ucon = new UserConnection(); ucon.GetUserToUserConnection(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID); model.UserConnectionID = ucon.UserConnectionID; if (BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID)) { return RedirectToAction("index", "home"); } } } else { if (uad.MembersOnlyProfile) { return RedirectToAction("LogOn", "Account"); } } ViewBag.ThumbIcon = uad.FullProfilePicURL; SetModelForUserAccount(model, uad); // var su = new StatusUpdate(); su.GetMostRecentUserStatus(_ua.UserAccountID); if (su.StatusUpdateID > 0) { model.LastStatusUpdate = su.CreateDate; model.MostRecentStatusUpdate = su.Message; } model.ProfileVisitorCount = ProfileLog.GetUniqueProfileVisitorCount(_ua.UserAccountID); GetUserPhotos(model); GetUserNews(model); model.MetaDescription = _ua.UserName + " " + Messages.Profile + " " + FromDate.DateToYYYY_MM_DD(_ua.LastActivityDate); GetUserPlaylist(); ForumThreads(_ua.UserAccountID, model); if (uad.UserAccountID > 0) { model.Birthday = uad.BirthDate; if (uad.ShowOnMapLegal) { // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added string currentLang = Utilities.GetCurrentLanguageCode(); Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); model.DisplayOnMap = uad.ShowOnMapLegal; var rnd = new Random(); int offset = rnd.Next(10, 100); SiteStructs.LatLong latlong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode); if (latlong.latitude != 0 && latlong.longitude != 0) { model.Latitude = Convert.ToDecimal(latlong.latitude + Convert.ToDouble("0.00" + offset)) .ToString(CultureInfo.InvariantCulture); model.Longitude = Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset)) .ToString(CultureInfo.InvariantCulture); } else { model.DisplayOnMap = false; } Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang); } ViewBag.ThumbIcon = uad.FullProfilePicThumbURL; LoadCurrentImagesViewBag(uad.UserAccountID); } ViewBag.UserAccountDetail = uad; ViewBag.UserAccount = _ua; GetUserContacts(model); UserAccountDetail uadLooker = null; if (_mu != null) { uadLooker = new UserAccountDetail(); uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(_mu.ProviderUserKey)); } if (uadLooker != null && (_mu != null && _ua.UserAccountID > 0 && uadLooker.EnableProfileLogging && uad.EnableProfileLogging)) { var pl = new ProfileLog { LookedAtUserAccountID = _ua.UserAccountID, LookingUserAccountID = Convert.ToInt32(_mu.ProviderUserKey) }; if (pl.LookingUserAccountID != pl.LookedAtUserAccountID) pl.Create(); ArrayList al = ProfileLog.GetRecentProfileViews(_ua.UserAccountID); if (al != null && al.Count > 0) { var uas = new UserAccounts(); foreach (UserAccount viewwer in al.Cast<int>().Select(id => new UserAccount(id)) .Where(viewwer => !viewwer.IsLockedOut && viewwer.IsApproved) .TakeWhile(viewwer => uas.Count < Maxcountusers)) { uas.Add(viewwer); } } } GetUserAccountVideos(); // this is either a youtube user or this is a band var art = new Artist(); art.GetArtistByAltname(userName); if (art.ArtistID > 0) { // try this way for dashers model.UserName = art.Name; } var vids = new Videos(); var sngrs = new SongRecords(); if (art.ArtistID == 0) { vids.GetAllVideosByUser(userName); var uavs = new UserAccountVideos(); uavs.GetRecentUserAccountVideos(_ua.UserAccountID, 'U'); foreach (Video f2 in uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f2 => !vids.Contains(f2))) { vids.Add(f2); } vids.Sort((x, y) => (y.PublishDate.CompareTo(x.PublishDate))); model.UserName = _ua != null ? _ua.UserName : userName; } else { GetArtistProfile(art, vids); } vids.Sort((p1, p2) => p2.PublishDate.CompareTo(p1.PublishDate)); sngrs.AddRange(vids.Select(v1 => new SongRecord(v1))); if (_mu != null && _ua.UserAccountID != Convert.ToInt32(_mu.ProviderUserKey)) { var uc1 = new UserConnection(); uc1.GetUserToUserConnection(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey)); if (uc1.UserConnectionID > 0) { switch (uc1.StatusType) { case 'C': if (uc1.IsConfirmed) { model.IsCyberFriend = true; } else { model.IsWatingToBeCyberFriend = true; } break; case 'R': if (uc1.IsConfirmed) { model.IsRealFriend = true; } else { model.IsWatingToBeRealFriend = true; } break; default: model.IsDeniedCyberFriend = true; model.IsDeniedRealFriend = true; break; } } } if (sngrs.Count == 0 && art.ArtistID == 0 && _ua.UserAccountID == 0) { // no longer exists Response.RedirectPermanent("/"); return new EmptyResult(); } var sngDisplay = new SongRecords(); sngDisplay.AddRange(from sr1 in sngrs let vidToShow = new Video(sr1.VideoID) where vidToShow.IsEnabled select sr1); model.SongRecords = sngDisplay.VideosList(); return View(model); }
protected void initControl(int ID) { if (ID > 0) { txtID.Value = Convert.ToString(ID); //btn_add.Visible = false; btn_edit.Visible = true; //btn_add1.Visible = false; //btn_add2.Visible = false; btn_edit1.Visible = true; try { SYS_WidgetPageLayoutBSO _widgetPageLayoutBSO = new SYS_WidgetPageLayoutBSO(); SYS_WidgetPageLayout _widgetPageLayout = _widgetPageLayoutBSO.GetSYS_WidgetPageLayoutById(ID); Bind_ddlPageLayout(); ddlPageLayout.SelectedValue = Convert.ToString(_widgetPageLayout.PageLayoutId); //Bind_ddlWidgetType(); Bind_ddlWidget(0); ddlWidget.SelectedValue = Convert.ToString(_widgetPageLayout.WidgetId); GetRegion(); ddlRegion.SelectedValue = _widgetPageLayout.RegionId; txtWidgetTitle.Text = _widgetPageLayout.Title; hddIcon.Value = _widgetPageLayout.Icon; //if (_widgetPageLayout.Icon != "") // ltl_icon.Text = "<img src='" + ResolveUrl("~/") + "Upload/Widgets/Icons/" + _widgetPageLayout.Icon + "' width='48px'>"; chkStatus.Checked = _widgetPageLayout.Status; hddRadInfo.Value = _widgetPageLayout.Info; hddRadHTML.Value = _widgetPageLayout.HTML; Bind_Gallary(); if (_widgetPageLayout.Value != "0" && _widgetPageLayout.Value != "") { VideosBSO _videoBSO = new VideosBSO(); Videos _video = _videoBSO.GetVideosById(Convert.ToInt32(_widgetPageLayout.Value)); if (_video != null) { BindVideo(_video.VideosCateID); lboVideo.SelectedValue = Convert.ToString(_widgetPageLayout.Value); lboGallary.SelectedValue = Convert.ToString(_video.VideosCateID); } } txtRecord.Text = _widgetPageLayout.Record.ToString();//sửa hddRecord2.Value = _widgetPageLayout.Record2.ToString(); //lboGallary.SelectedValue = _widgetPageLayout.Value; //sửa hddValue2.Value = _widgetPageLayout.Value2; hddOrders.Value = _widgetPageLayout.Orders.ToString(); } catch (Exception ex) { error.Text = ex.Message.ToString(); } } else { Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();"); } }
public Videos.VideoID_Get.Result VideoID_Get(Videos.VideoID_Get.Command command) { return _ApiEndpoints._Client.GetResult<Videos.VideoID_Get.Command, Videos.VideoID_Get.Result>(command); }
/// <summary> /// Method to update video tribute details /// </summary> /// <param name="objVideoDetails">Filled Video entity</param> public object UpdateVideoTributeDetails(Videos objVideoDetails) { return FacadeManager.VideoManager.UpdateVideoTributeDetails(objVideoDetails); }
public ActionResult ManageVideos() { mu = Membership.GetUser(); UserAccountVideos uavs = new UserAccountVideos(); uavs.GetVideosForUserAccount(Convert.ToInt32(mu.ProviderUserKey), 'U'); if (uavs.Count > 0) { Videos favvids = new Videos(); Video f1 = new Video(); foreach (UserAccountVideo uav1 in uavs) { f1 = new Video(uav1.VideoID); if (f1.IsEnabled) favvids.Add(f1); } SongRecord sng1 = null; SongRecords sngrcds2 = new SongRecords(); foreach (Video v1 in favvids) { sng1 = new SongRecord(v1); sngrcds2.Add(sng1); } sngrcds2.IsUserSelected = true; sngrcds2.EnableChangeOrder = false; ViewBag.UserUploaded = sngrcds2.VideoPlaylist(); } return View(uavs); }
/// <summary> /// Method to delete video /// </summary> /// <param name="objVideo">Video entity containing Video Id</param> public void DeleteVideo(Videos objVideo) { FacadeManager.VideoManager.DeleteVideo(objVideo); }
/// <summary> /// Method to save Video /// </summary> /// <param name="objVideo">Filled Video Entity</param> /// <returns>Video Id</returns> public bool SaveVideo(Videos objVideo, string type) { //if(Equals(type,"VideoTribute")) return FacadeManager.VideoManager.SaveVideo(objVideo, type); }
/// <summary> /// 添加视频信息 /// </summary> /// <param name="videos"></param> /// <returns></returns> public int AddVideos(Videos videos) { throw new NotImplementedException(); }