fixed duplicate image downloading
This commit is contained in:
parent
caf50d0b93
commit
20d27c3bc3
|
@ -361,7 +361,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
}
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count < ConfigurationManager.Configuration.MaxBackdrops)
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0)
|
||||
{
|
||||
var nodes = doc.SelectNodes("//fanart/movie/moviebackgrounds//@url");
|
||||
|
||||
|
|
|
@ -231,10 +231,8 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
|
||||
var status = ProviderRefreshStatus.Success;
|
||||
|
||||
var hasLocalPoster = item.HasImage(ImageType.Primary);
|
||||
|
||||
// poster
|
||||
if (images.posters != null && images.posters.Count > 0 && (ConfigurationManager.Configuration.RefreshItemImages || !hasLocalPoster))
|
||||
if (images.posters != null && images.posters.Count > 0 && !item.HasImage(ImageType.Primary))
|
||||
{
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
|
@ -281,16 +279,13 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
|
||||
var tmdbImageUrl = tmdbSettings.images.base_url + ConfigurationManager.Configuration.TmdbFetchedBackdropSize;
|
||||
|
||||
//backdrops should be in order of rating. get first n ones
|
||||
var numToFetch = Math.Max(images.backdrops.Count - ConfigurationManager.Configuration.MaxBackdrops, 0);
|
||||
|
||||
for (var i = 0; i < numToFetch; i++)
|
||||
for (var i = 0; i < images.backdrops.Count; i++)
|
||||
{
|
||||
var bdName = "backdrop" + (i == 0 ? "" : i.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
var hasLocalBackdrop = item.LocationType == LocationType.FileSystem && ConfigurationManager.Configuration.SaveLocalMeta ? item.HasLocalImage(bdName) : item.BackdropImagePaths.Count > i;
|
||||
|
||||
if (ConfigurationManager.Configuration.RefreshItemImages || !hasLocalBackdrop)
|
||||
if (!hasLocalBackdrop)
|
||||
{
|
||||
var img = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
|
@ -301,6 +296,11 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||
|
||||
item.BackdropImagePaths.Add(await _providerManager.SaveImage(item, img, bdName + Path.GetExtension(images.backdrops[i].file_path), ConfigurationManager.Configuration.SaveLocalMeta && item.LocationType == LocationType.FileSystem, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
if (item.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MaxBackdrops)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
return;
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.RefreshItemImages || !season.HasImage(ImageType.Primary))
|
||||
if (!season.HasImage(ImageType.Primary))
|
||||
{
|
||||
var n = images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber + "'][Language='" + ConfigurationManager.Configuration.PreferredMetadataLanguage + "']") ??
|
||||
images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber + "'][Language='en']");
|
||||
|
@ -237,7 +237,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
}
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Banner && (ConfigurationManager.Configuration.RefreshItemImages || !season.HasImage(ImageType.Banner)))
|
||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Banner && !season.HasImage(ImageType.Banner))
|
||||
{
|
||||
var n = images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber + "'][Language='" + ConfigurationManager.Configuration.PreferredMetadataLanguage + "']") ??
|
||||
images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber + "'][Language='en']");
|
||||
|
@ -272,7 +272,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
}
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Backdrops && (ConfigurationManager.Configuration.RefreshItemImages || season.BackdropImagePaths.Count == 0))
|
||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Backdrops && season.BackdropImagePaths.Count == 0)
|
||||
{
|
||||
var n = images.SelectSingleNode("//Banner[BannerType='fanart'][Season='" + seasonNumber + "']");
|
||||
if (n != null)
|
||||
|
|
|
@ -226,7 +226,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// <returns>Task.</returns>
|
||||
private async Task FetchImages(Series series, XmlDocument images, CancellationToken cancellationToken)
|
||||
{
|
||||
if (ConfigurationManager.Configuration.RefreshItemImages || !series.HasImage(ImageType.Primary))
|
||||
if (!series.HasImage(ImageType.Primary))
|
||||
{
|
||||
var n = images.SelectSingleNode("//Banner[BannerType='poster']");
|
||||
if (n != null)
|
||||
|
@ -239,7 +239,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
}
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && (ConfigurationManager.Configuration.RefreshItemImages || !series.HasImage(ImageType.Banner)))
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.HasImage(ImageType.Banner))
|
||||
{
|
||||
var n = images.SelectSingleNode("//Banner[BannerType='series']");
|
||||
if (n != null)
|
||||
|
|
Loading…
Reference in New Issue
Block a user