|
|
|
@ -45,12 +45,21 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
var updateType = ItemUpdateType.None;
|
|
|
|
|
var requiresRefresh = false;
|
|
|
|
|
|
|
|
|
|
var libraryOptions = LibraryManager.GetLibraryOptions((BaseItem)item);
|
|
|
|
|
|
|
|
|
|
if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None)
|
|
|
|
|
{
|
|
|
|
|
// TODO: If this returns true, should we instead just change metadata refresh mode to Full?
|
|
|
|
|
requiresRefresh = item.RequiresRefresh();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!requiresRefresh &&
|
|
|
|
|
libraryOptions.AutomaticRefreshIntervalDays > 0 &&
|
|
|
|
|
(DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= libraryOptions.AutomaticRefreshIntervalDays)
|
|
|
|
|
{
|
|
|
|
|
requiresRefresh = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var itemImageProvider = new ItemImageProvider(Logger, ProviderManager, ServerConfigurationManager, FileSystem);
|
|
|
|
|
var localImagesFailed = false;
|
|
|
|
|
|
|
|
|
@ -116,8 +125,6 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LibraryOptions libraryOptions = null;
|
|
|
|
|
|
|
|
|
|
// Next run remote image providers, but only if local image providers didn't throw an exception
|
|
|
|
|
if (!localImagesFailed && refreshOptions.ImageRefreshMode != ImageRefreshMode.ValidationOnly)
|
|
|
|
|
{
|
|
|
|
@ -125,11 +132,6 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
|
|
|
|
|
if (providers.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (libraryOptions == null)
|
|
|
|
|
{
|
|
|
|
|
libraryOptions = LibraryManager.GetLibraryOptions((BaseItem)item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var result = await itemImageProvider.RefreshImages(itemOfType, libraryOptions, providers, refreshOptions, config, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
updateType = updateType | result.UpdateType;
|
|
|
|
@ -177,11 +179,6 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
item.DateLastRefreshed = default(DateTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (libraryOptions == null)
|
|
|
|
|
{
|
|
|
|
|
libraryOptions = LibraryManager.GetLibraryOptions((BaseItem)item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Save to database
|
|
|
|
|
await SaveItem(metadataResult, libraryOptions, updateType, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|