コード例 #1
0
        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);
        }
コード例 #2
0
        /// <summary>
        /// This handles syncing the local info with brightcove
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            pnlNewMessage.Visible    = false;
            pnlUpdateMessage.Visible = false;

            UpdateType utype = UpdateType.NEW;

            if (radUpdate.SelectedValue.Equals("update"))
            {
                utype = UpdateType.UPDATE;
            }
            else if (radUpdate.SelectedValue.Equals("both"))
            {
                utype = UpdateType.BOTH;
            }

            //import/update the videos
            List <BCVideo> videos = bc.FindAllVideos().Videos;
            UpdateInsertPair <VideoItem> vidUIP = accountItem.ImportToSitecore(videos, utype);

            //import/update the playlists
            List <BCPlaylist> playlists             = bc.FindAllPlaylists().Playlists;
            UpdateInsertPair <PlaylistItem> playUIP = accountItem.ImportToSitecore(playlists, utype);

            if (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.NEW))
            {
                //show message over how many things changed
                pnlNewMessage.Visible = true;
                ltlNewItem.Text       = vidUIP.NewItems.Count.ToString();
                ltlNewPlaylists.Text  = playUIP.NewItems.Count.ToString();
            }
            if (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.UPDATE))
            {
                pnlUpdateMessage.Visible = true;
                ltlUpdatedItems.Text     = vidUIP.UpdatedItems.Count.ToString();
                ltlUpdatedPlaylists.Text = playUIP.UpdatedItems.Count.ToString();
            }

            //display the current video and playlist count
            ltlTotalPlaylists.Text = accountItem.PlaylistLib.Playlists.Count.ToString();
            ltlTotalVideos.Text    = accountItem.VideoLib.Videos.Count.ToString();
        }
コード例 #3
0
        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);
        }