Ejemplo n.º 1
0
        public async Task<IEnumerable<ChannelItemInfo>> Search(ChannelSearchInfo searchInfo, Controller.Entities.User user, CancellationToken cancellationToken)
        {
            var downloader = new VimeoListingDownloader(_logger, _jsonSerializer, _httpClient);
            var search = await downloader.GetSearchVimeoList(searchInfo.SearchTerm, cancellationToken);

            return search.Select(i => new ChannelItemInfo
            {
                ContentType = ChannelMediaContentType.Clip,
                ImageUrl = i.thumbnails[0].Url,
                IsInfiniteStream = false,
                MediaType = ChannelMediaType.Video,
                Name = i.title,
                Overview = i.description,
                Type = ChannelItemType.Media,
                Id = i.urls[0].Value.GetMD5().ToString("N"),

                MediaSources = new List<ChannelMediaInfo>
                {
                    new ChannelMediaInfo
                    {
                         Path = i.urls[0].Value,
                         Height = i.height,
                         Width = i.width
                    }
                }
            });
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <ChannelItemInfo> > Search(ChannelSearchInfo searchInfo, Controller.Entities.User user, CancellationToken cancellationToken)
        {
            var downloader = new VimeoListingDownloader(_logger, _jsonSerializer, _httpClient);
            var search     = await downloader.GetSearchVimeoList(searchInfo.SearchTerm, cancellationToken);

            return(search.Select(i => new ChannelItemInfo
            {
                ContentType = ChannelMediaContentType.Clip,
                ImageUrl = i.thumbnails[0].Url,
                IsInfiniteStream = false,
                MediaType = ChannelMediaType.Video,
                Name = i.title,
                Overview = i.description,
                Type = ChannelItemType.Media,
                Id = i.urls[0].Value.GetMD5().ToString("N"),

                MediaSources = new List <ChannelMediaInfo>
                {
                    new ChannelMediaInfo
                    {
                        Path = i.urls[0].Value,
                        Height = i.height,
                        Width = i.width
                    }
                }
            }));
        }
Ejemplo n.º 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  = 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
            });
        }
Ejemplo n.º 4
0
        private async Task <ChannelItemResult> GetChannelItemsInternal(InternalChannelItemQuery query,
                                                                       CancellationToken cancellationToken)
        {
            var downloader = new VimeoListingDownloader(_logger, _jsonSerializer, _httpClient);
            var catSplit   = query.FolderId.Split('_');
            var videos     = new Videos();

            if (catSplit.Count() == 3)
            {
                if (catSplit[1] == "allVideos")
                {
                    videos = await downloader.GetCategoryVideoList(catSplit[2], query.StartIndex, query.Limit, cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    videos = await downloader.GetVimeoList(catSplit[2], query.StartIndex, query.Limit, cancellationToken).ConfigureAwait(false);
                }
            }
            else
            {
                videos = await downloader.GetVimeoList(catSplit[1], query.StartIndex, query.Limit, cancellationToken).ConfigureAwait(false);
            }

            var 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)
            });

            return(new ChannelItemResult
            {
                Items = items.ToList(),
                TotalRecordCount = videos.total
            });
        }
Ejemplo n.º 5
0
        private async Task<ChannelItemResult> GetChannelItemsInternal(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var downloader = new VimeoListingDownloader(_logger, _jsonSerializer, _httpClient);
            var videos = await downloader.GetVimeoList(query.CategoryId, query.StartIndex, query.Limit, cancellationToken)
                .ConfigureAwait(false);

            var 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()

            });

            return new ChannelItemResult
            {
                Items = items.ToList(),
                CacheLength = TimeSpan.FromDays(1),
                TotalRecordCount = videos.total
            };
        }
Ejemplo n.º 6
0
        private async Task<ChannelItemResult> GetChannelItemsInternal(InternalChannelItemQuery query,
            CancellationToken cancellationToken)
        {
            var downloader = new VimeoListingDownloader(_logger, _jsonSerializer, _httpClient);
            var catSplit = query.FolderId.Split('_');
            var videos = new Videos();

            if (catSplit.Count() == 3)
            {
                if (catSplit[1] == "allVideos")
                    videos = await downloader.GetCategoryVideoList(catSplit[2], query.StartIndex, query.Limit, cancellationToken).ConfigureAwait(false);
                else
                    videos = await downloader.GetVimeoList(catSplit[2], query.StartIndex, query.Limit, cancellationToken).ConfigureAwait(false);
            }
            else
                videos = await downloader.GetVimeoList(catSplit[1], query.StartIndex, query.Limit, cancellationToken).ConfigureAwait(false);

            var 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)

                });

            return new ChannelItemResult
            {
                Items = items.ToList(),
                TotalRecordCount = videos.total
            };
        }
Ejemplo n.º 7
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
            };
        }