示例#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);
        }
示例#2
0
        public override async Task <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.Instance.Get <IChannelService>();
            Channel         fullChannel    = channelService.GetChannel(channel.ChannelId);
            bool            isTv           = fullChannel.MediaType == 0;

            return(await CreateMediaItem(slotIndex, streamUrl, channel, isTv, fullChannel.ToChannel()));
        }