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);
        }
Esempio n. 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 film = await _apiClient.GetSingleFilm(kinopoiskId, cancellationToken);

            return(await FilterEmptyImages(film.ToRemoteImageInfos()));
        }
Esempio n. 3
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));
        }
Esempio n. 4
0
        public async Task <MetadataResult <TItemType> > GetMetadata(TLookupInfoType info, CancellationToken cancellationToken)
        {
            var result = new MetadataResult <TItemType>()
            {
                QueriedById    = true,
                Provider       = Constants.ProviderName,
                ResultLanguage = Constants.ProviderMetadataLanguage
            };

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

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

            var film = await _apiClient.GetSingleFilm(kinopoiskId, cancellationToken);

            cancellationToken.ThrowIfCancellationRequested();

            result.Item = ConvertResponseToItem(film);
            if (result.Item != null)
            {
                result.HasMetadata = true;
            }

            var staff = await _apiClient.GetStaff(kinopoiskId, cancellationToken);

            cancellationToken.ThrowIfCancellationRequested();

            var sanitizedPersons = await SanitizeEmptyImagePersonInfos(staff.ToPersonInfos());

            foreach (var item in sanitizedPersons)
            {
                result.AddPerson(item);
            }

            var trailers = await _apiClient.GetTrailers(kinopoiskId, cancellationToken);

            var remoteTrailers = trailers.ToMediaUrls();

            if (remoteTrailers is not null)
            {
                result.Item.RemoteTrailers = remoteTrailers;
            }

            return(result);
        }