add option to refresh metadata every N number of days

This commit is contained in:
Luke Pulverenti 2017-03-14 15:44:11 -04:00
parent a0934e6226
commit 8d72c7e881
5 changed files with 15 additions and 16 deletions

View File

@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.Dto
}
}
//if (!(item is LiveTvProgram) || fields.Contains(ItemFields.PlayAccess))
if (!(item is LiveTvProgram) || fields.Contains(ItemFields.PlayAccess))
{
dto.PlayAccess = item.GetPlayAccess(user);
}
@ -1639,7 +1639,7 @@ namespace Emby.Server.Implementations.Dto
var width = size.Width;
var height = size.Height;
if (width == 0 || height == 0)
if (width.Equals(0) || height.Equals(0))
{
return null;
}

View File

@ -16,6 +16,8 @@
public bool EnableAutomaticSeriesGrouping { get; set; }
public bool EnableEmbeddedTitles { get; set; }
public int AutomaticRefreshIntervalDays { get; set; }
/// <summary>
/// Gets or sets the preferred metadata language.
/// </summary>

View File

@ -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);
}

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.696</version>
<version>3.0.697</version>
<title>Emby.Common</title>
<authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.696</version>
<version>3.0.697</version>
<title>Emby.Server.Core</title>
<authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners>