updated nuget
This commit is contained in:
parent
c0f606683a
commit
eced7ed068
|
@ -76,7 +76,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
refreshResult.LastErrorMessage = string.Empty;
|
||||
refreshResult.LastStatus = ProviderRefreshStatus.Success;
|
||||
|
||||
var imageProviders = GetImageProviders(item).ToList();
|
||||
var itemImageProvider = new ItemImageProvider(Logger, ProviderManager, ServerConfigurationManager);
|
||||
var localImagesFailed = false;
|
||||
|
||||
|
@ -84,7 +83,7 @@ namespace MediaBrowser.Providers.Manager
|
|||
try
|
||||
{
|
||||
// Always validate images and check for new locally stored ones.
|
||||
if (itemImageProvider.ValidateImages(item, imageProviders))
|
||||
if (itemImageProvider.ValidateImages(item, GetLocalImageProviders(item)))
|
||||
{
|
||||
updateType = updateType | ItemUpdateType.ImageUpdate;
|
||||
}
|
||||
|
@ -113,12 +112,13 @@ namespace MediaBrowser.Providers.Manager
|
|||
}
|
||||
|
||||
// Next run remote image providers, but only if local image providers didn't throw an exception
|
||||
if (!localImagesFailed)
|
||||
if (!localImagesFailed && options.ImageRefreshMode != MetadataRefreshMode.None)
|
||||
{
|
||||
if ((options.ImageRefreshMode == MetadataRefreshMode.EnsureMetadata && !lastResult.DateLastImagesRefresh.HasValue) ||
|
||||
options.ImageRefreshMode == MetadataRefreshMode.FullRefresh)
|
||||
var providers = GetNonLocalImageProviders(item, lastResult.DateLastImagesRefresh.HasValue, options).ToList();
|
||||
|
||||
if (providers.Count > 0)
|
||||
{
|
||||
var result = await itemImageProvider.RefreshImages(itemOfType, imageProviders, options, cancellationToken).ConfigureAwait(false);
|
||||
var result = await itemImageProvider.RefreshImages(itemOfType, providers, options, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
updateType = updateType | result.UpdateType;
|
||||
refreshResult.AddStatus(result.Status, result.ErrorMessage);
|
||||
|
@ -173,13 +173,49 @@ namespace MediaBrowser.Providers.Manager
|
|||
// If local providers are the only ones with changes, then just run those
|
||||
if (providersWithChanges.All(i => i is ILocalMetadataProvider))
|
||||
{
|
||||
providers = providers.Where(i => i is ILocalMetadataProvider).ToList();
|
||||
providers = providersWithChanges.Count == 0 ?
|
||||
new List<IMetadataProvider<TItemType>>() :
|
||||
providers.Where(i => i is ILocalMetadataProvider).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
return providers;
|
||||
}
|
||||
|
||||
protected virtual IEnumerable<IImageProvider> GetNonLocalImageProviders(IHasMetadata item, bool hasRefreshedImages, ImageRefreshOptions options)
|
||||
{
|
||||
// Get providers to refresh
|
||||
var providers = _imageProviders.Where(i =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return !(i is ILocalImageProvider) && i.Supports(item);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error in ImageProvider.Supports", ex, i.Name);
|
||||
|
||||
return false;
|
||||
}
|
||||
}).ToList();
|
||||
|
||||
// Run all if either of these flags are true
|
||||
var runAllProviders = options.ImageRefreshMode == MetadataRefreshMode.FullRefresh || !hasRefreshedImages;
|
||||
|
||||
if (!runAllProviders)
|
||||
{
|
||||
// Avoid implicitly captured closure
|
||||
var currentItem = item;
|
||||
|
||||
providers = providers.OfType<IHasChangeMonitor>()
|
||||
.Where(i => i.HasChanged(currentItem, currentItem.DateLastSaved))
|
||||
.Cast<IImageProvider>()
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return providers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this instance can refresh the specified provider.
|
||||
/// </summary>
|
||||
|
@ -323,9 +359,9 @@ namespace MediaBrowser.Providers.Manager
|
|||
}
|
||||
}
|
||||
|
||||
private IEnumerable<IImageProvider> GetImageProviders(IHasImages item)
|
||||
private IEnumerable<ILocalImageProvider> GetLocalImageProviders(IHasImages item)
|
||||
{
|
||||
var providers = _imageProviders.Where(i =>
|
||||
return _imageProviders.OfType<ILocalImageProvider>().Where(i =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -338,13 +374,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!ServerConfigurationManager.Configuration.EnableInternetProviders)
|
||||
{
|
||||
providers = providers.Where(i => !(i is IRemoteImageProvider));
|
||||
}
|
||||
|
||||
return providers.OrderBy(i => i.Order);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
public bool HasChanged(IHasMetadata item, DateTime date)
|
||||
{
|
||||
return !item.HasImage(ImageType.Primary) && (DateTime.UtcNow - date).TotalHours >= 12;
|
||||
return !item.HasImage(ImageType.Primary) && (DateTime.UtcNow - date).TotalHours >= 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.309</version>
|
||||
<version>3.0.310</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.309" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.310" />
|
||||
<dependency id="NLog" version="2.1.0" />
|
||||
<dependency id="SimpleInjector" version="2.4.1" />
|
||||
<dependency id="sharpcompress" version="0.10.2" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.309</version>
|
||||
<version>3.0.310</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.309</version>
|
||||
<version>3.0.310</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.309" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.310" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user