예제 #1
0
        public async Task <IEnumerable <RemoteSearchResult> > GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
        {
            var results = new Dictionary <string, RemoteSearchResult>();

            var aid = searchInfo.ProviderIds.GetOrDefault(provider_name);

            if (!string.IsNullOrEmpty(aid))
            {
                if (!results.ContainsKey(aid))
                {
                    results.Add(aid, await ProxerApi.GetAnime(aid));
                }
            }

            if (!string.IsNullOrEmpty(searchInfo.Name))
            {
                List <string> ids = await ProxerApi.Search_GetSeries_list(searchInfo.Name, cancellationToken);

                foreach (string a in ids)
                {
                    results.Add(a, await ProxerApi.GetAnime(a));
                }
            }

            return(results.Values);
        }
예제 #2
0
        public async Task <IEnumerable <RemoteImageInfo> > GetImages(string aid, CancellationToken cancellationToken)
        {
            var list = new List <RemoteImageInfo>();

            if (!string.IsNullOrEmpty(aid))
            {
                var primary = ProxerApi.Get_ImageUrl(await ProxerApi.WebRequestAPI(ProxerApi.Proxer_anime_link + aid));
                list.Add(new RemoteImageInfo
                {
                    ProviderName = Name,
                    Type         = ImageType.Primary,
                    Url          = await primary
                });
            }
            return(list);
        }
예제 #3
0
        public async Task <MetadataResult <Series> > GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
        {
            var result = new MetadataResult <Series>();

            var aid = info.ProviderIds.GetOrDefault(provider_name);

            if (string.IsNullOrEmpty(aid))
            {
                _log.LogInformation("Start Proxer... Searching({Name})", info.Name);
                aid = await ProxerApi.FindSeries(info.Name, cancellationToken);
            }

            if (!string.IsNullOrEmpty(aid))
            {
                string WebContent = await ProxerApi.WebRequestAPI(ProxerApi.Proxer_anime_link + aid);

                result.Item        = new Series();
                result.HasMetadata = true;

                result.Item.ProviderIds.Add(provider_name, aid);
                result.Item.Overview = await ProxerApi.Get_Overview(WebContent);

                result.ResultLanguage = "ger";
                try
                {
                    result.Item.CommunityRating = float.Parse(await ProxerApi.Get_Rating(WebContent), System.Globalization.CultureInfo.InvariantCulture);
                }
                catch (Exception) { }
                foreach (var genre in await ProxerApi.Get_Genre(WebContent))
                {
                    result.Item.AddGenre(genre);
                }
                GenreHelper.CleanupGenres(result.Item);
                StoreImageUrl(aid, await ProxerApi.Get_ImageUrl(WebContent), "image");
            }
            return(result);
        }