示例#1
0
        private async Task <ChannelItemResult> GetChannelItemsInternal(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var offset     = query.StartIndex.GetValueOrDefault();
            var downloader = new TwitchListingDownloader(_logger, _jsonSerializer, _httpClient);
            var videos     = await downloader.GetStreamList(query.FolderId, offset, cancellationToken)
                             .ConfigureAwait(false);

            var items = videos.streams.OrderByDescending(x => x.viewers)
                        .Select(i => new ChannelItemInfo
            {
                ContentType      = ChannelMediaContentType.Clip,
                ImageUrl         = i.preview.large,
                IsInfiniteStream = true,
                MediaType        = ChannelMediaType.Video,
                Name             = i.channel.name,
                Id              = i.channel.name,
                Type            = ChannelItemType.Media,
                CommunityRating = Convert.ToSingle(i.viewers),
                DateCreated     = !String.IsNullOrEmpty(i.channel.created_at) ?
                                  Convert.ToDateTime(i.channel.created_at) : (DateTime?)null,
                Overview = i.channel.status,
            });

            return(new ChannelItemResult
            {
                Items = items.ToList(),
                TotalRecordCount = videos._total
            });
        }
        private async Task<IEnumerable<ChannelItemInfo>> GetChannelItems(String catID, CancellationToken cancellationToken)
        {
            var downloader = new TwitchListingDownloader(_logger, _jsonSerializer, _httpClient);
            var videos = await downloader.GetStreamList(catID, cancellationToken)
                .ConfigureAwait(false);

            return videos.streams.Select(i => new ChannelItemInfo
            {
                ContentType = ChannelMediaContentType.Clip,
                ImageUrl = i.preview.large,
                IsInfiniteStream = true,
                MediaType = ChannelMediaType.Video,
                Name = i.channel.name,
                Type = ChannelItemType.Media,
                Id = i.channel.name
            });
        }
        private async Task<ChannelItemResult> GetChannelItemsInternal(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var offset = query.StartIndex.GetValueOrDefault();
            var downloader = new TwitchListingDownloader(_logger, _jsonSerializer, _httpClient);
            var videos = await downloader.GetStreamList(query.FolderId, offset, cancellationToken)
                .ConfigureAwait(false);

            var items = videos.streams.OrderByDescending(x => x.viewers)
                .Select(i => new ChannelItemInfo
            {
                ContentType = ChannelMediaContentType.Clip,
                ImageUrl = i.preview.large,
                IsInfiniteStream = true,
                MediaType = ChannelMediaType.Video,
                Name = i.channel.name,
                Id = i.channel.name,
                Type = ChannelItemType.Media,
                CommunityRating = Convert.ToSingle(i.viewers),
                DateCreated = !String.IsNullOrEmpty(i.channel.created_at) ? 
                    Convert.ToDateTime(i.channel.created_at) : (DateTime?)null,
                Overview = i.channel.status,
            });

            return new ChannelItemResult
            {
                Items = items.ToList(),
                TotalRecordCount = videos._total
            };
        }