Пример #1
0
        public async Task <IEnumerable <RemoteSearchResult> > GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
        {
            var metadata = await GetMetadata(searchInfo, cancellationToken).ConfigureAwait(false);

            var list = new List <RemoteSearchResult>();

            if (metadata.HasMetadata)
            {
                var seriesId      = metadata.Item.ProviderIds.GetOrDefault(ProviderNames.AniDb);
                var imageProvider = new AniDbImageProvider(_httpClient, _appPaths);
                var images        = await imageProvider.GetImages(seriesId, cancellationToken);

                var res = new RemoteSearchResult
                {
                    Name               = metadata.Item.Name,
                    PremiereDate       = metadata.Item.PremiereDate,
                    ProductionYear     = metadata.Item.ProductionYear,
                    ImageUrl           = images.Any() ? images.First().Url : null,
                    ProviderIds        = metadata.Item.ProviderIds,
                    SearchProviderName = Name
                };

                list.Add(res);
            }

            return(list);
        }
        public Task <HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
        {
            var imageProvider = new AniDbImageProvider(_httpClient, _configurationManager.ApplicationPaths);

            return(imageProvider.GetImageResponse(url, cancellationToken));
        }