示例#1
0
        protected virtual Video CreateVideo(Item accountItem, VideoToUpload video)
        {
            var authenticator = new OoyalaAthenticator(accountItem);
            var context       = new RestContext(Constants.SitecoreRestSharpService, authenticator);

            return(context.Create <VideoToUpload, Video>("upload_video_create", video).Data);
        }
示例#2
0
        /// <summary>
        /// Creates a channel.
        /// </summary>
        /// <param name="operation">
        /// The operation.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        protected override object Create(ExportOperation operation)
        {
            var synchronizer = MediaFrameworkContext.GetItemSynchronizer(operation.Item);

            if (synchronizer == null)
            {
                return(null);
            }

            var authenticator = new OoyalaAthenticator(operation.AccountItem);

            var context = new RestContext(Constants.SitecoreRestSharpService, authenticator);

            var channel = (Channel)synchronizer.CreateEntity(operation.Item);

            channel.EmbedCode            = null;
            channel.CreatedAt            = null;
            channel.UpdatedAt            = null;
            channel.Duration             = null;
            channel.PostProcessingStatus = null;
            channel.Metadata             = null;
            channel.PreviewImageUrl      = null;
            channel.Status = null;

            var createdChannel = context.Create <Channel, Channel>("create_channel", channel).Data;

            this.UpdateLineup(operation, createdChannel.EmbedCode);
            this.UpdateLabels(operation, createdChannel.EmbedCode);
            this.UpdatePlayer(operation, createdChannel.EmbedCode);
            this.UpdateMetadata(operation, createdChannel.EmbedCode);

            return(createdChannel);
        }
        protected override object Create(ExportOperation operation)
        {
            var synchronizer = MediaFrameworkContext.GetItemSynchronizer(operation.Item);

            if (synchronizer == null)
            {
                return(null);
            }

            var playlist = (PlayList)synchronizer.CreateEntity(operation.Item);

            playlist.Id           = null;
            playlist.ReferenceId  = null;
            playlist.ThumbnailUrl = null;

            //Video ids used only for EXPLICIT playlist.
            //In other case will be used filter tags & tag inclusion
            if (playlist.PlaylistType == PlaylistType.EXPLICIT.ToString())
            {
                playlist.FilterTags   = null;
                playlist.TagInclusion = null;
            }
            else
            {
                playlist.VideoIds = null;
            }

            var authenticator = new BrightcoveAthenticator(operation.AccountItem);

            var updateData = new PostData("create_playlist", authenticator, "playlist", playlist);

            var context = new RestContext(Constants.SitecoreRestSharpService, authenticator);

            var data = context.Create <PostData, ResultData <string> >("update_data", updateData).Data;


            if (data != null && !string.IsNullOrEmpty(data.Result))
            {
                //we could not to use existing playlist object because it does not contain all data
                var playlistData = context.Read <PlayList>("read_playlist_by_id",
                                                           new List <Parameter>
                {
                    new Parameter {
                        Type = ParameterType.UrlSegment, Name = "playlist_id", Value = data.Result
                    }
                }).Data;

                if (playlistData == null)
                {
                    playlist.Id = data.Result;
                    return(playlist);
                }

                return(playlistData);
            }

            return(null);
        }
        /// <summary>
        /// Creates a player.
        /// </summary>
        /// <param name="operation">
        /// The operation.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        protected override object Create(ExportOperation operation)
        {
            var synchronizer = MediaFrameworkContext.GetItemSynchronizer(operation.Item);

            if (synchronizer == null)
            {
                return(null);
            }

            var authenticator = new OoyalaAthenticator(operation.AccountItem);

            var context = new RestContext(Constants.SitecoreRestSharpService, authenticator);

            var player = (Player)synchronizer.CreateEntity(operation.Item);

            player.Id        = null;
            player.IsDefault = false;

            return(context.Create <Player, Player>("create_player", player).Data);
        }
示例#5
0
        /// <summary>
        /// Creates a label.
        /// </summary>
        /// <param name="operation">
        /// The operation.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        protected override object Create(ExportOperation operation)
        {
            var synchronizer = MediaFrameworkContext.GetItemSynchronizer(operation.Item);

            if (synchronizer == null)
            {
                return(null);
            }

            var authenticator = new OoyalaAthenticator(operation.AccountItem);

            var context = new RestContext(Constants.SitecoreRestSharpService, authenticator);

            var label = (Label)synchronizer.CreateEntity(operation.Item);

            return(context.Create <Label, Label>(
                       "create_label",
                       new Label
            {
                Name = label.Name,
                ParentId = !string.IsNullOrEmpty(label.ParentId) ? label.ParentId : "root"
            }).Data);
        }