protected void Page_Load(object sender, EventArgs e) { try { //get the current item and database currentDB = Sitecore.Configuration.Factory.GetDatabase("master"); currentItem = new PlaylistItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]); Item acct = currentItem.playlistItem.Parent.Parent; //if current parent isn't the account then it's the parent of the folder if (!acct.TemplateName.Equals("Account Folder")) { acct = acct.Parent; } accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database); bc = new BCAPI(accountItem.PublisherID); if (!IsPostBack) { loadFormWithCurrentValues(); //load non-editable information ltlPlaylistID.Text = currentItem.PlaylistID.ToString(); ltlVideos.Text = currentItem.VideoIds.Count.ToString(); ltlAccount.Text = currentItem.AccountId.ToString(); } } catch (Exception ex) { ltlError.Text = ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { //available querystring values for context info (id, language, version, database) try { //get the current item and database currentDB = Sitecore.Configuration.Factory.GetDatabase("master"); currentItem = new VideoItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]); Item acct = currentItem.videoItem.Parent.Parent; //if current parent isn't the account then it's the parent of the folder if (!acct.TemplateName.Equals("Account Folder")) { acct = acct.Parent; } accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database); bc = new BCAPI(accountItem.PublisherID); if (!currentItem.ThumbnailURL.Equals("")) { pnlThumb.Visible = true; imgThumb.ImageUrl = currentItem.ThumbnailURL; } if (!currentItem.VideoStillURL.Equals("")) { pnlStill.Visible = true; imgStill.ImageUrl = currentItem.VideoStillURL; } } catch (Exception ex) { ltlError.Text = ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { //available querystring values for context info (id, language, version, database) try { //get the current item and database currentDB = Sitecore.Configuration.Factory.GetDatabase("master"); currentItem = new VideoItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]); Item acct = currentItem.videoItem.Parent.Parent; //if current parent isn't the account then it's the parent of the folder if (!acct.TemplateName.Equals("Account Folder")) { acct = acct.Parent; } accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database); bc = new BCAPI(accountItem.PublisherID); //set the form values for the video if (!IsPostBack) { loadFormWithCurrentValues(); } //show the video id ltlVideoID.Text = currentItem.VideoID.ToString(); //show the video upload status RPCResponse<UploadStatusEnum> rpcr = bc.GetUploadStatus(currentItem.VideoID); ltlStatus.Text = rpcr.result.ToString(); ltlCreation.Text = currentItem.CreationDate.ToString("MMMM d, yyyy"); ltlModified.Text = currentItem.LastModifiedDate.ToString("MMMM d, yyyy"); ltlPublished.Text = currentItem.PublishedDate.ToString("MMMM d, yyyy"); try { long milliseconds = currentItem.Length; string lengthText = ""; long hours = (milliseconds / 60000000); if (hours >= 1) { milliseconds -= hours * 60000000; lengthText += hours + " hours, "; } long mins = (milliseconds / 60000); if (mins >= 1) { milliseconds -= mins * 60000; lengthText += mins + " minutes, "; } long secs = (milliseconds / 1000); if (secs >= 1) { milliseconds -= secs * 1000; lengthText += secs + " seconds"; } ltlLength.Text = lengthText; } catch(Exception ex){ } ltlPlays.Text = currentItem.PlaysTotal.ToString(); ltlPlaysTrailing.Text = currentItem.PlaysTrailingWeek.ToString(); } catch (Exception ex) { ltlError.Text = ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { //available querystring values for context info (id, language, version, database) try { //get the current item and database currentDB = Sitecore.Configuration.Factory.GetDatabase("master"); currentItem = new PlayerItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]); Item acct = currentItem.playerItem.Parent.Parent; //if current parent isn't the account then it's the parent of the folder if (!acct.TemplateName.Equals("Account Folder")) { acct = acct.Parent; } accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database); bc = new BCAPI(accountItem.PublisherID); //populate drop down if (!IsPostBack) { foreach (Item itm in accountItem.Parent.ChildByTemplateAndName("Settings Folder", "Settings").ChildByTemplateAndName("Enum", "WMode").GetChildren()) { ddlWMode.Items.Add(new ListItem(itm.DisplayName, itm.DisplayName)); } //fill player drop down foreach (VideoItem vp in accountItem.VideoLib.Videos) { ddlVideo.Items.Add(new ListItem(vp.VideoName, vp.videoItem.ID.ToString())); } //fill playlist drop down foreach (PlaylistItem pl in accountItem.PlaylistLib.Playlists) { cblPlaylist.Items.Add(new ListItem(pl.PlaylistName, pl.playlistItem.ID.ToString())); } if (!currentItem.PlaylistType.Equals(PlayerPlaylistType.None) && cblPlaylist.Items.Count > 0) { cblPlaylist.SelectedIndex = 0; } //set the initial player up if (ddlVideo.Items.Count > 0) { SetVideoPlayer(); } else { ltlMessage.Text = "To use the preview section you must have already defined at least one player"; } } } catch(Exception ex){ ltlError.Text = ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { //get the current item and database currentDB = Sitecore.Configuration.Factory.GetDatabase("master"); currentItem = currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]; accountItem = new AccountItem(currentItem.ID, currentItem.InnerData, currentItem.Database); bc = new BCAPI(accountItem.PublisherID); //display the current video and playlist count ltlTotalPlaylists.Text = accountItem.PlaylistLib.Playlists.Count.ToString(); ltlTotalVideos.Text = accountItem.VideoLib.Videos.Count.ToString(); } catch(Exception ex){ ltlError.Text = "There was an error loading this page. You probably need to set the publisher Id<br/><br/>"; ltlError.Text += ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { //available querystring values for context info (id, language, version, database) //disabling this for now pnlUpload.Visible = false; try { //get the current item and database currentDB = Sitecore.Configuration.Factory.GetDatabase("master"); currentItem = currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]; accountItem = new AccountItem(currentItem.Parent.ID, currentItem.Parent.InnerData, currentItem.Parent.Database); bc = new BCAPI(accountItem.PublisherID); //display the current video and playlist count ltlTotalVideos.Text = accountItem.VideoLib.Videos.Count.ToString(); } catch (Exception ex) { ltlError.Text = ex.ToString(); } }
public void ResetApiConnection() { if (this.accountConfig == null) { this.bcApi = null; return; } try { BrightcoveConfig config = new BrightcoveConfig(); config.Accounts.Add(this.accountConfig); this.bcApi = new BCAPI(config.Accounts[0]); } catch { // Do nothing } }
public static string[] GetAllVideos(BCAPI api, int pageNumber, string query) { string[] result = null; if (api != null) { List<BrightcoveSDK.VideoFields> videoSearchFields = new List<VideoFields>(); int itemsPerPage = 50; int itemCount = 0; BCQueryResult videos = null; videoSearchFields.Add(VideoFields.NAME); if (!string.IsNullOrEmpty(query)) { query = query.Trim(); } else { query = string.Empty; } if (query.Length == 0) { videos = api.FindAllVideos(itemsPerPage, BCSortByType.MODIFIED_DATE, BCSortOrderType.DESC, null, null, MediaDeliveryTypeEnum.DEFAULT, pageNumber, true); } else { videos = api.FindVideosByText(query, itemsPerPage, BCSortByType.MODIFIED_DATE, BCSortOrderType.DESC, null, null, MediaDeliveryTypeEnum.DEFAULT, pageNumber, true); } if (videos != null) { itemCount = videos.TotalCount; } result = new string[videos.TotalCount]; for (int i = 0; i < videos.Videos.Count; i++) { BCVideo video = videos.Videos[i]; if (i < itemsPerPage) { result[i] = string.Format(@"{{ ""id"":{0}, ""name"":'{1}', ""thumbnailURL"":'{2}' }}", video.id, Util.FixParam(video.name), Util.FixParam(video.thumbnailURL)); } else { result[i] = "null"; } } } return result; }
public static string[] GetAllPlaylists(BCAPI api, int pageNumber, string query) { string[] result = null; if (api != null) { int itemsPerPage = 50; int itemCount = 0; BCQueryResult playlists = null; // Cannot search playlists yet, but in the future use "query" -ACA 9/12/2011 if (!string.IsNullOrEmpty(query)) { query = query.Trim().ToLower(); } else { query = string.Empty; } playlists = api.FindAllPlaylists(itemsPerPage, BCSortByType.MODIFIED_DATE, BCSortOrderType.DESC, null, null, Util.PlaylistBrowseFields, MediaDeliveryTypeEnum.DEFAULT, pageNumber, true); if (playlists != null) { itemCount = playlists.TotalCount; } result = new string[playlists.TotalCount]; for (int i = 0; i < playlists.Playlists.Count; i++) { if (i < itemsPerPage) { BCPlaylist playlist = playlists.Playlists[i]; result[i] = string.Format(@"{{ ""id"":{0}, ""name"":'{1}', ""thumbnailURL"":'{2}' }}", playlist.id, Util.FixParam(playlist.name), Util.FixParam(playlist.thumbnailURL)); } else { result[i] = "null"; } } } return result.ToArray(); }
public static string[] GetAllPlaylists(BCAPI api, int pageNumber, string query, string order, string sort) { string[] result = null; if (api != null) { int itemsPerPage = 50; int itemCount = 0; BCQueryResult playlists = null; List<BCPlaylist> playListsSorted = new List<BCPlaylist>(); // Cannot search playlists yet, but in the future use "query" -ACA 9/12/2011 if (!string.IsNullOrEmpty(query)) { query = query.Trim().ToLower(); } else { query = string.Empty; } playlists = api.FindAllPlaylists(itemsPerPage, getSort(sort), getOrder(order), null, null, Util.PlaylistBrowseFields, MediaDeliveryTypeEnum.DEFAULT, pageNumber, true); if (sort != null) { if (sort.Equals("display name")) { if (order.Equals("ascending")) { playListsSorted = playlists.Playlists.OrderBy(i => i.name).ToList(); } else { playListsSorted = playlists.Playlists.OrderByDescending(i => i.name).ToList(); } } } if (playListsSorted != null) { if (playListsSorted.Count == 0) { playListsSorted = playlists.Playlists; } } if (playlists != null) { itemCount = playListsSorted.Count; } result = new string[playListsSorted.Count]; for (int i = 0; i < playListsSorted.Count; i++) { if (i < itemsPerPage) { BCPlaylist playlist = playListsSorted[i]; result[i] = string.Format(@"{{ ""id"":{0}, ""name"":'{1}', ""thumbnailURL"":'{2}' }}", playlist.id, Util.FixParam(playlist.name), Util.FixParam(playlist.thumbnailURL)); } else { result[i] = "null"; } } } return result.ToArray(); }
public static string[] GetAllVideos(BCAPI api, int pageNumber, string query, string order, string sort) { string[] result = null; if (api != null) { List<BrightcoveSDK.VideoFields> videoSearchFields = new List<VideoFields>(); int itemsPerPage = 50; int itemCount = 0; BCQueryResult videos = null; List<BCVideo> videosSorted = new List<BCVideo>(); videoSearchFields.Add(VideoFields.NAME); if (!string.IsNullOrEmpty(query)) { query = query.Trim(); } else { query = string.Empty; } if (query.Length == 0) { videos = api.FindAllVideos(itemsPerPage, getSort(sort), getOrder(order), null, null, MediaDeliveryTypeEnum.DEFAULT, pageNumber, true); } else { videos = api.FindVideosByText(query, itemsPerPage, getSort(sort), getOrder(order), null, null, MediaDeliveryTypeEnum.DEFAULT, pageNumber, true); } if (videos != null) { itemCount = videos.TotalCount; } if (sort != null) { if (sort.Equals("display name")) { if (order.Equals("ascending")) { videosSorted = videos.Videos.OrderBy(i => i.name).ToList(); } else { videosSorted = videos.Videos.OrderByDescending(i => i.name).ToList(); } } } if (videosSorted != null) { if (videosSorted.Count == 0) { videosSorted = videos.Videos; } } result = new string[videosSorted.Count]; for (int i = 0; i < videosSorted.Count; i++) { BCVideo video = videosSorted[i]; if (i < itemsPerPage) { result[i] = string.Format(@"{{ ""id"":{0}, ""name"":'{1}', ""thumbnailURL"":'{2}' }}", video.id, Util.FixParam(video.name), Util.FixParam(video.thumbnailURL)); } else { result[i] = "null"; } } } return result; }