public async Task <MetadataResult <Person> > GetMetadata(PersonLookupInfo info, CancellationToken cancellationToken)
        {
            var result = new MetadataResult <Person>()
            {
                QueriedById    = true,
                Provider       = Constants.ProviderName,
                ResultLanguage = Constants.ProviderMetadataLanguage
            };

            var(resolveResult, kinopoiskId) = await _providerIdResolver.TryResolve(info, cancellationToken);

            if (!resolveResult)
            {
                return(result);
            }

            var person = await _apiClient.GetPerson(kinopoiskId, cancellationToken);

            cancellationToken.ThrowIfCancellationRequested();

            result.Item = person.ToPerson();
            if (result.Item != null)
            {
                result.HasMetadata = true;
            }

            return(result);
        }
Beispiel #2
0
        public override async Task <IEnumerable <RemoteImageInfo> > GetImages(BaseItem item, CancellationToken cancellationToken)
        {
            var(resolveResult, kinopoiskId) = await _providerIdResolver.TryResolve(item, cancellationToken);

            if (!resolveResult)
            {
                return(Enumerable.Empty <RemoteImageInfo>());
            }

            var person = await _apiClient.GetPerson(kinopoiskId, cancellationToken);

            var res = new[] { person.ToRemoteImageInfo() };

            return(await FilterEmptyImages(res));
        }