Пример #1
0
        private async Task<ChannelItemResult> GetSubCategories(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var downloader = new VimeoCategoryDownloader(_logger, _jsonSerializer, _httpClient);
            var channels = await downloader.GetVimeoSubCategory(query.CategoryId, cancellationToken);

            channels.subCategories.Add(new VimeoAPI.API.Channel
            {
                id = "allVideos_" + query.CategoryId,
                name = "All Videos"
            });

            var items = channels.subCategories.Select(i => new ChannelItemInfo
            {
                Type = ChannelItemType.Category,
                //ImageUrl = i,
                Name = i.name,
                Id = "subcat_" + i.id,
            }).ToList();

            return new ChannelItemResult
            {
                Items = items,
                CacheLength = TimeSpan.FromDays(1),
            };
        }
Пример #2
0
        private async Task<ChannelItemResult> GetCategories(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var downloader = new VimeoCategoryDownloader(_logger, _jsonSerializer, _httpClient);
            var channels = await downloader.GetVimeoCategoryList(query.StartIndex, query.Limit, cancellationToken);

            var items = channels.Select(i => new ChannelItemInfo
            {
                Type = ChannelItemType.Category,
                ImageUrl = i.image,
                Name = i.name,
                Id = "cat_" + i.id,
            }).ToList();

            return new ChannelItemResult
            {
                Items = items,
                CacheLength = TimeSpan.FromDays(1),
                TotalRecordCount = channels.total
            };
        }
Пример #3
0
        private async Task<ChannelItemResult> GetCategories(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var downloader = new VimeoCategoryDownloader(_logger, _jsonSerializer, _httpClient);
            var channels = await downloader.GetVimeoCategoryList(query.StartIndex, query.Limit, cancellationToken);

            if (Plugin.Instance.Configuration.Token != null && Plugin.Instance.Configuration.SecretToken != null)
            {
                channels.Add(new Category
                {
                    id = "myChannels",
                    name = "My Channels"
                });
            }

            var items = channels.Select(i => new ChannelItemInfo
            {
                Type = ChannelItemType.Folder,
                ImageUrl = i.image,
                Name = i.name,
                Id = "cat_" + i.id,
            }).ToList();

            return new ChannelItemResult
            {
                Items = items,
                TotalRecordCount = channels.total
            };
        }