Beispiel #1
0
        public MediaItem CreateMediaItem(int slotIndex, string streamUrl, IChannel channel)
        {
            // Channel is usually only passed as placeholder with ID only, so query the details here
            IChannelService channelService = GlobalServiceProvider.Get <IChannelService>();
            Channel         fullChannel    = channelService.GetChannel(channel.ChannelId);

            bool            isTv     = fullChannel.MediaType == 0;
            LiveTvMediaItem tvStream = isTv
        ? SlimTvMediaItemBuilder.CreateMediaItem(slotIndex, streamUrl, fullChannel.ToChannel())
        : SlimTvMediaItemBuilder.CreateRadioMediaItem(slotIndex, streamUrl, fullChannel.ToChannel());

            if (tvStream != null)
            {
                // Add program infos to the LiveTvMediaItem
                IProgram currentProgram;
                IProgram nextProgram;
                if (GetNowNextProgram(channel, out currentProgram, out nextProgram))
                {
                    tvStream.AdditionalProperties[LiveTvMediaItem.CURRENT_PROGRAM] = currentProgram;
                    tvStream.AdditionalProperties[LiveTvMediaItem.NEXT_PROGRAM]    = nextProgram;
                }
                return(tvStream);
            }
            return(null);
        }
        protected virtual MediaItem CreateMediaItem(int slotIndex, string streamUrl, IChannel channel, bool isTv, IChannel fullChannel)
        {
            LiveTvMediaItem tvStream = isTv
        ? SlimTvMediaItemBuilder.CreateMediaItem(slotIndex, streamUrl, fullChannel)
        : SlimTvMediaItemBuilder.CreateRadioMediaItem(slotIndex, streamUrl, fullChannel);

            if (tvStream != null)
            {
                // Add program infos to the LiveTvMediaItem
                IProgram currentProgram;
                IProgram nextProgram;
                if (GetNowNextProgram(channel, out currentProgram, out nextProgram))
                {
                    tvStream.AdditionalProperties[LiveTvMediaItem.CURRENT_PROGRAM] = currentProgram;
                    tvStream.AdditionalProperties[LiveTvMediaItem.NEXT_PROGRAM]    = nextProgram;
                }
                return(tvStream);
            }
            return(null);
        }
Beispiel #3
0
        protected virtual async Task <MediaItem> CreateMediaItem(int slotIndex, string streamUrl, IChannel channel, bool isTv, IChannel fullChannel)
        {
            LiveTvMediaItem tvStream = isTv
        ? SlimTvMediaItemBuilder.CreateMediaItem(slotIndex, streamUrl, fullChannel)
        : SlimTvMediaItemBuilder.CreateRadioMediaItem(slotIndex, streamUrl, fullChannel);

            if (tvStream != null)
            {
                // Add program infos to the LiveTvMediaItem
                var result = await GetNowNextProgramAsync(channel);

                if (result.Success)
                {
                    tvStream.AdditionalProperties[LiveTvMediaItem.CURRENT_PROGRAM] = result.Result[0];
                    tvStream.AdditionalProperties[LiveTvMediaItem.NEXT_PROGRAM]    = result.Result[1];
                }
                return(tvStream);
            }
            return(null);
        }
Beispiel #4
0
        public MediaItem CreateMediaItem(int slotIndex, string streamUrl, IChannel channel)
        {
            LiveTvMediaItem tvStream = SlimTvMediaItemBuilder.CreateMediaItem(slotIndex, streamUrl, channel);

            if (tvStream != null)
            {
                // Add program infos to the LiveTvMediaItem
                IProgram currentProgram;
                if (GetCurrentProgram(channel, out currentProgram))
                {
                    tvStream.AdditionalProperties[LiveTvMediaItem.CURRENT_PROGRAM] = currentProgram;
                }

                IProgram nextProgram;
                if (GetNextProgram(channel, out nextProgram))
                {
                    tvStream.AdditionalProperties[LiveTvMediaItem.NEXT_PROGRAM] = nextProgram;
                }

                return(tvStream);
            }
            return(null);
        }