From 7859e449f683a195f2482b46ae8139dde9ad8bb7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 21 May 2013 13:17:01 -0400 Subject: [PATCH] account for non-file system items --- .../Providers/Movies/MovieDbImagesProvider.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/Providers/Movies/MovieDbImagesProvider.cs b/MediaBrowser.Controller/Providers/Movies/MovieDbImagesProvider.cs index e64b4c2c6..17d284edb 100644 --- a/MediaBrowser.Controller/Providers/Movies/MovieDbImagesProvider.cs +++ b/MediaBrowser.Controller/Providers/Movies/MovieDbImagesProvider.cs @@ -282,13 +282,17 @@ namespace MediaBrowser.Controller.Providers.Movies var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false); var tmdbImageUrl = tmdbSettings.images.base_url + ConfigurationManager.Configuration.TmdbFetchedBackdropSize; + //backdrops should be in order of rating. get first n ones - var numToFetch = Math.Min(ConfigurationManager.Configuration.MaxBackdrops, images.backdrops.Count); + var numToFetch = Math.Max(images.backdrops.Count - ConfigurationManager.Configuration.MaxBackdrops, 0); + for (var i = 0; i < numToFetch; i++) { var bdName = "backdrop" + (i == 0 ? "" : i.ToString(CultureInfo.InvariantCulture)); - if (ConfigurationManager.Configuration.RefreshItemImages || !item.HasLocalImage(bdName)) + var hasLocalBackdrop = item.LocationType == LocationType.FileSystem && ConfigurationManager.Configuration.SaveLocalMeta ? item.HasLocalImage(bdName) : item.BackdropImagePaths.Count > i; + + if (ConfigurationManager.Configuration.RefreshItemImages || !hasLocalBackdrop) { var img = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions {