public MovieDbPersonProvider(IFileSystem fileSystem, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient)
 {
     _fileSystem           = fileSystem;
     _configurationManager = configurationManager;
     _jsonSerializer       = jsonSerializer;
     _httpClient           = httpClient;
     Current = this;
 }
        public MovieDbPersonProvider(IFileSystem fileSystem, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger)
        {
            _fileSystem           = fileSystem;
            _configurationManager = configurationManager;
            _jsonSerializer       = jsonSerializer;
            _httpClient           = httpClient;
            _logger = logger;
            Current = this;

            _requestCountReset = new Timer(OnRequestThrottleTimerFired, null, TimeSpan.FromHours(1), TimeSpan.FromHours(1));
        }
Beispiel #3
0
        public async Task <IEnumerable <RemoteImageInfo> > GetImages(BaseItem item, CancellationToken cancellationToken)
        {
            var person = (Person)item;
            var id     = person.GetProviderId(MetadataProviders.Tmdb);

            if (!string.IsNullOrEmpty(id))
            {
                await MovieDbPersonProvider.Current.EnsurePersonInfo(id, cancellationToken).ConfigureAwait(false);

                var dataFilePath = MovieDbPersonProvider.GetPersonDataFilePath(_config.ApplicationPaths, id);

                var result = _jsonSerializer.DeserializeFromFile <MovieDbPersonProvider.PersonResult>(dataFilePath);

                var images = result.images ?? new MovieDbPersonProvider.Images();

                var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);

                var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");

                return(GetImages(images, item.GetPreferredMetadataLanguage(), tmdbImageUrl));
            }

            return(new List <RemoteImageInfo>());
        }