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

            var items  = new List <ChannelItemInfo>();
            var videos = new Videos();

            if (channels != null)
            {
                items = channels.Select(i => new ChannelItemInfo
                {
                    Type     = ChannelItemType.Folder,
                    ImageUrl = i.logo_url,
                    Name     = i.name,
                    Id       = "chan_" + i.id,
                    Overview = i.description
                }).ToList();
            }
            else
            {
                var downloader2 = new VimeoListingDownloader(_logger, _jsonSerializer, _httpClient);
                videos = await downloader2.GetCategoryVideoList(query.FolderId, query.StartIndex, query.Limit, cancellationToken);

                items = videos.Select(i => new ChannelItemInfo
                {
                    ContentType      = ChannelMediaContentType.Clip,
                    ImageUrl         = i.thumbnails[2].Url,
                    IsInfiniteStream = false,
                    MediaType        = ChannelMediaType.Video,
                    Name             = i.title,
                    Overview         = i.description,
                    Type             = ChannelItemType.Media,
                    Id           = i.id,
                    RunTimeTicks = TimeSpan.FromSeconds(i.duration).Ticks,
                    Tags         = i.tags == null ? new List <string>() : i.tags.Select(t => t.title).ToList(),
                    DateCreated  = DateTime.Parse(i.upload_date)
                }).ToList();
            }

            return(new ChannelItemResult
            {
                Items = items,
                TotalRecordCount = channels == null ? videos.total : channels.total
            });
        }
Пример #2
0
        private async Task <ChannelItemResult> GetPersonalChannels(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var downloader = new VimeoChannelDownloader(_logger, _jsonSerializer, _httpClient);
            var pChannels  = await downloader.GetPersonalChannelList(query, cancellationToken);


            var items = pChannels.Select(i => new ChannelItemInfo
            {
                Type     = ChannelItemType.Folder,
                ImageUrl = i.logo_url,
                Name     = i.name,
                Id       = "chan_" + i.id,
                Overview = i.description
            }).ToList();

            return(new ChannelItemResult
            {
                Items = items,
                TotalRecordCount = pChannels.total
            });
        }
Пример #3
0
        private async Task<ChannelItemResult> GetChannels(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var downloader = new VimeoChannelDownloader(_logger, _jsonSerializer, _httpClient);
            var channels = await downloader.GetVimeoChannelList(query, cancellationToken);

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

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

            var items = new List<ChannelItemInfo>();
            var videos = new Videos();

            if (channels != null)
            {
                items = channels.Select(i => new ChannelItemInfo
                {
                    Type = ChannelItemType.Folder,
                    ImageUrl = i.logo_url,
                    Name = i.name,
                    Id = "chan_" + i.id,
                    Overview = i.description
                }).ToList();
            }
            else
            {
                var downloader2 = new VimeoListingDownloader(_logger, _jsonSerializer, _httpClient);
                videos = await downloader2.GetCategoryVideoList(query.FolderId, query.StartIndex, query.Limit, cancellationToken);

                items = videos.Select(i => new ChannelItemInfo
                {
                    ContentType = ChannelMediaContentType.Clip,
                    ImageUrl = i.thumbnails[2].Url,
                    IsInfiniteStream = false,
                    MediaType = ChannelMediaType.Video,
                    Name = i.title,
                    Overview = i.description,
                    Type = ChannelItemType.Media,
                    Id = i.id,
                    RunTimeTicks = TimeSpan.FromSeconds(i.duration).Ticks,
                    Tags = i.tags == null ? new List<string>() : i.tags.Select(t => t.title).ToList(),
                    DateCreated = DateTime.Parse(i.upload_date)
                }).ToList();
            }

            return new ChannelItemResult
            {
                Items = items,
                TotalRecordCount = channels == null ? videos.total : channels.total
            };
        }