fixes #1124 - Download Missing Images does not work when Item is locked

pull/702/head
Luke 9 years ago committed by Luke Pulverenti
parent 3231c07ae1
commit f31efcb62d

@ -97,7 +97,7 @@ namespace MediaBrowser.Providers.Manager
var itemImageProvider = new ItemImageProvider(Logger, ProviderManager, ServerConfigurationManager, FileSystem);
var localImagesFailed = false;
var allImageProviders = ((ProviderManager)ProviderManager).GetImageProviders(item).ToList();
var allImageProviders = ((ProviderManager)ProviderManager).GetImageProviders(item, refreshOptions).ToList();
// Start by validating images
try

@ -249,17 +249,17 @@ namespace MediaBrowser.Providers.Manager
});
}
public IEnumerable<IImageProvider> GetImageProviders(IHasImages item)
public IEnumerable<IImageProvider> GetImageProviders(IHasImages item, ImageRefreshOptions refreshOptions)
{
return GetImageProviders(item, GetMetadataOptions(item), false);
return GetImageProviders(item, GetMetadataOptions(item), refreshOptions, false);
}
private IEnumerable<IImageProvider> GetImageProviders(IHasImages item, MetadataOptions options, bool includeDisabled)
private IEnumerable<IImageProvider> GetImageProviders(IHasImages item, MetadataOptions options, ImageRefreshOptions refreshOptions, bool includeDisabled)
{
// Avoid implicitly captured closure
var currentOptions = options;
return ImageProviders.Where(i => CanRefresh(i, item, options, includeDisabled))
return ImageProviders.Where(i => CanRefresh(i, item, options, refreshOptions, includeDisabled))
.OrderBy(i =>
{
// See if there's a user-defined order
@ -315,7 +315,7 @@ namespace MediaBrowser.Providers.Manager
{
var options = GetMetadataOptions(item);
return GetImageProviders(item, options, includeDisabled).OfType<IRemoteImageProvider>();
return GetImageProviders(item, options, new ImageRefreshOptions(new DirectoryService(_fileSystem)), includeDisabled).OfType<IRemoteImageProvider>();
}
private bool CanRefresh(IMetadataProvider provider, IHasMetadata item, MetadataOptions options, bool includeDisabled, bool checkIsOwnedItem)
@ -359,14 +359,17 @@ namespace MediaBrowser.Providers.Manager
return true;
}
private bool CanRefresh(IImageProvider provider, IHasImages item, MetadataOptions options, bool includeDisabled)
private bool CanRefresh(IImageProvider provider, IHasImages item, MetadataOptions options, ImageRefreshOptions refreshOptions, bool includeDisabled)
{
if (!includeDisabled)
{
// If locked only allow local providers
if (item.IsLocked && !(provider is ILocalImageProvider))
{
return false;
if (refreshOptions.ImageRefreshMode != ImageRefreshMode.FullRefresh)
{
return false;
}
}
if (provider is IRemoteImageProvider || provider is IDynamicImageProvider)
@ -502,7 +505,7 @@ namespace MediaBrowser.Providers.Manager
ItemType = typeof(T).Name
};
var imageProviders = GetImageProviders(dummy, options, true).ToList();
var imageProviders = GetImageProviders(dummy, options, new ImageRefreshOptions(new DirectoryService(_fileSystem)), true).ToList();
AddMetadataPlugins(summary.Plugins, dummy, options);
AddImagePlugins(summary.Plugins, dummy, imageProviders);

Loading…
Cancel
Save