private async Task <ChannelItemResult> GetEpisodes(InternalChannelItemQuery query, CancellationToken cancellationToken) { var offset = query.StartIndex.GetValueOrDefault(); var downloader = new Revision3ListingDownloader(_logger, _jsonSerializer, _httpClient); var videos = await downloader.GetEpisodeList(offset, query, cancellationToken) .ConfigureAwait(false); var episodes = videos.episodes.Select(i => new ChannelItemInfo { ContentType = ChannelMediaContentType.Clip, ImageUrl = !String.IsNullOrEmpty(i.images.medium) ? i.images.medium : "", MediaType = ChannelMediaType.Video, Name = i.name, Type = ChannelItemType.Media, Id = i.slug, RunTimeTicks = TimeSpan.FromSeconds(i.duration).Ticks, DateCreated = !String.IsNullOrEmpty(i.published) ? Convert.ToDateTime(i.published) : DateTime.MinValue, Overview = !String.IsNullOrEmpty(i.summary) ? i.summary : "", }); //var orderedEpisodes = OrderItems(episodes.ToList(), query, cancellationToken); return(new ChannelItemResult { Items = episodes.ToList(), TotalRecordCount = videos.total }); }
public async Task <IEnumerable <ChannelItemInfo> > GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken) { var downloader = new Revision3ListingDownloader(_logger, _jsonSerializer, _httpClient); var videos = await downloader.GetLatestEpisodeList(cancellationToken) .ConfigureAwait(false); return(videos.episodes.Select(i => new ChannelItemInfo { ContentType = ChannelMediaContentType.Clip, ImageUrl = !String.IsNullOrEmpty(i.images.medium) ? i.images.medium : "", MediaType = ChannelMediaType.Video, Name = i.show.name + " - " + i.name, Type = ChannelItemType.Media, Id = i.slug, RunTimeTicks = TimeSpan.FromSeconds(i.duration).Ticks, DateCreated = !String.IsNullOrEmpty(i.published) ? Convert.ToDateTime(i.published) : DateTime.MinValue, Overview = !String.IsNullOrEmpty(i.summary) ? i.summary : "" }).OrderByDescending(i => i.DateCreated)); }
private async Task<ChannelItemResult> GetEpisodes(InternalChannelItemQuery query, CancellationToken cancellationToken) { var offset = query.StartIndex.GetValueOrDefault(); var downloader = new Revision3ListingDownloader(_logger, _jsonSerializer, _httpClient); var videos = await downloader.GetEpisodeList(offset, query, cancellationToken) .ConfigureAwait(false); var episodes = videos.episodes.Select(i => new ChannelItemInfo { ContentType = ChannelMediaContentType.Clip, ImageUrl = !String.IsNullOrEmpty(i.images.medium) ? i.images.medium : "", MediaType = ChannelMediaType.Video, Name = i.name, Type = ChannelItemType.Media, Id = i.video_id, RunTimeTicks = TimeSpan.FromSeconds(i.duration).Ticks, DateCreated = !String.IsNullOrEmpty(i.published) ? Convert.ToDateTime(i.published) : DateTime.MinValue, Overview = !String.IsNullOrEmpty(i.summary) ? i.summary : "", }); //var orderedEpisodes = OrderItems(episodes.ToList(), query, cancellationToken); return new ChannelItemResult { Items = episodes.ToList(), TotalRecordCount = videos.total }; }
public async Task<IEnumerable<ChannelItemInfo>> GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken) { var downloader = new Revision3ListingDownloader(_logger, _jsonSerializer, _httpClient); var videos = await downloader.GetLatestEpisodeList(cancellationToken) .ConfigureAwait(false); return videos.episodes.Select(i => new ChannelItemInfo { ContentType = ChannelMediaContentType.Clip, ImageUrl = !String.IsNullOrEmpty(i.images.medium) ? i.images.medium : "", MediaType = ChannelMediaType.Video, Name = i.show.name + " - " + i.name, Type = ChannelItemType.Media, Id = i.video_id, RunTimeTicks = TimeSpan.FromSeconds(i.duration).Ticks, DateCreated = !String.IsNullOrEmpty(i.published) ? Convert.ToDateTime(i.published) : DateTime.MinValue, Overview = !String.IsNullOrEmpty(i.summary) ? i.summary : "" }).OrderByDescending(i => i.DateCreated); }