예제 #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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #5
0
        public object Get(GetChannels request)
        {
            var result = GetChannelsAsync(request).Result;

            return(ToOptimizedResult(result));
        }