public async Task <IEnumerable <RemoteImageInfo> > GetImages(string aid, CancellationToken cancellationToken) { var list = new List <RemoteImageInfo>(); if (!string.IsNullOrEmpty(aid)) { var primary = _aniListApi.Get_ImageUrl(await _aniListApi.WebRequestAPI(_aniListApi.AniList_anime_link.Replace("{0}", aid))); list.Add(new RemoteImageInfo { ProviderName = Name, Type = ImageType.Primary, Url = primary }); } return(list); }
public async Task <MetadataResult <Series> > GetMetadata(SeriesInfo info, CancellationToken cancellationToken) { var result = new MetadataResult <Series>(); var aid = info.ProviderIds.GetOrDefault(ProviderNames.AniList); if (string.IsNullOrEmpty(aid)) { _log.LogInformation("Start AniList... Searching({Name})", info.Name); aid = await _aniListApi.FindSeries(info.Name, cancellationToken); } if (!string.IsNullOrEmpty(aid)) { RootObject WebContent = await _aniListApi.WebRequestAPI(_aniListApi.AniList_anime_link.Replace("{0}", aid)); result.Item = new Series(); result.HasMetadata = true; result.People = await _aniListApi.GetPersonInfo(WebContent.data.Media.id, cancellationToken); result.Item.ProviderIds.Add(ProviderNames.AniList, aid); result.Item.Overview = WebContent.data.Media.description; try { //AniList has a max rating of 5 result.Item.CommunityRating = WebContent.data.Media.averageScore / 10; } catch (Exception) { } foreach (var genre in _aniListApi.Get_Genre(WebContent)) { result.Item.AddGenre(genre); } GenreHelper.CleanupGenres(result.Item); StoreImageUrl(aid, WebContent.data.Media.coverImage.large, "image"); } return(result); }