Ejemplo n.º 1
0
        public async Task <object> Get(GetChannels request)
        {
            var channelResult = await _liveTvManager.GetInternalChannels(new LiveTvChannelQuery
            {
                ChannelType           = request.Type,
                UserId                = request.UserId,
                StartIndex            = request.StartIndex,
                Limit                 = request.Limit,
                IsFavorite            = request.IsFavorite,
                IsLiked               = request.IsLiked,
                IsDisliked            = request.IsDisliked,
                EnableFavoriteSorting = request.EnableFavoriteSorting,
                AddCurrentProgram     = request.AddCurrentProgram
            }, CancellationToken.None).ConfigureAwait(false);

            var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(request.UserId);

            var returnArray = _dtoService.GetBaseItemDtos(channelResult.Items, GetDtoOptions(Request), user).ToArray();

            var result = new QueryResult <BaseItemDto>
            {
                Items            = returnArray,
                TotalRecordCount = channelResult.TotalRecordCount
            };

            return(ToOptimizedSerializedResultUsingCache(result));
        }
Ejemplo n.º 2
0
        private async Task <IEnumerable <ChannelInfoDto> > GetChannelsAsync(GetChannels request)
        {
            var services = _liveTvManager.Services;

            var tasks = services.Select(i => i.GetChannelsAsync(CancellationToken.None));

            var channelLists = await Task.WhenAll(tasks).ConfigureAwait(false);

            // Aggregate all channels from all services
            return(channelLists.SelectMany(i => i)
                   .Select(_liveTvManager.GetChannelInfoDto));
        }
Ejemplo n.º 3
0
        public object Get(GetChannels request)
        {
            var result = _liveTvManager.GetChannels(new ChannelQuery
            {
                ChannelType = request.Type,
                UserId      = request.UserId,
                StartIndex  = request.StartIndex,
                Limit       = request.Limit
            }, CancellationToken.None).Result;

            return(ToOptimizedSerializedResultUsingCache(result));
        }
Ejemplo n.º 4
0
        public async Task <object> Get(GetChannels request)
        {
            var result = await _liveTvManager.GetChannels(new LiveTvChannelQuery
            {
                ChannelType = request.Type,
                UserId      = request.UserId,
                StartIndex  = request.StartIndex,
                Limit       = request.Limit,
                IsFavorite  = request.IsFavorite,
                IsLiked     = request.IsLiked,
                IsDisliked  = request.IsDisliked
            }, CancellationToken.None).ConfigureAwait(false);

            return(ToOptimizedSerializedResultUsingCache(result));
        }
Ejemplo n.º 5
0
        public object Get(GetChannels request)
        {
            var result = GetChannelsAsync(request).Result;

            return(ToOptimizedResult(result));
        }