add option to refresh metadata every N number of days
This commit is contained in:
parent
a0934e6226
commit
8d72c7e881
|
@ -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);
|
dto.PlayAccess = item.GetPlayAccess(user);
|
||||||
}
|
}
|
||||||
|
@ -1639,7 +1639,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
var width = size.Width;
|
var width = size.Width;
|
||||||
var height = size.Height;
|
var height = size.Height;
|
||||||
|
|
||||||
if (width == 0 || height == 0)
|
if (width.Equals(0) || height.Equals(0))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
public bool EnableAutomaticSeriesGrouping { get; set; }
|
public bool EnableAutomaticSeriesGrouping { get; set; }
|
||||||
public bool EnableEmbeddedTitles { get; set; }
|
public bool EnableEmbeddedTitles { get; set; }
|
||||||
|
|
||||||
|
public int AutomaticRefreshIntervalDays { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the preferred metadata language.
|
/// Gets or sets the preferred metadata language.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -45,12 +45,21 @@ namespace MediaBrowser.Providers.Manager
|
||||||
var updateType = ItemUpdateType.None;
|
var updateType = ItemUpdateType.None;
|
||||||
var requiresRefresh = false;
|
var requiresRefresh = false;
|
||||||
|
|
||||||
|
var libraryOptions = LibraryManager.GetLibraryOptions((BaseItem)item);
|
||||||
|
|
||||||
if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None)
|
if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None)
|
||||||
{
|
{
|
||||||
// TODO: If this returns true, should we instead just change metadata refresh mode to Full?
|
// TODO: If this returns true, should we instead just change metadata refresh mode to Full?
|
||||||
requiresRefresh = item.RequiresRefresh();
|
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 itemImageProvider = new ItemImageProvider(Logger, ProviderManager, ServerConfigurationManager, FileSystem);
|
||||||
var localImagesFailed = false;
|
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
|
// Next run remote image providers, but only if local image providers didn't throw an exception
|
||||||
if (!localImagesFailed && refreshOptions.ImageRefreshMode != ImageRefreshMode.ValidationOnly)
|
if (!localImagesFailed && refreshOptions.ImageRefreshMode != ImageRefreshMode.ValidationOnly)
|
||||||
{
|
{
|
||||||
|
@ -125,11 +132,6 @@ namespace MediaBrowser.Providers.Manager
|
||||||
|
|
||||||
if (providers.Count > 0)
|
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);
|
var result = await itemImageProvider.RefreshImages(itemOfType, libraryOptions, providers, refreshOptions, config, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
updateType = updateType | result.UpdateType;
|
updateType = updateType | result.UpdateType;
|
||||||
|
@ -177,11 +179,6 @@ namespace MediaBrowser.Providers.Manager
|
||||||
item.DateLastRefreshed = default(DateTime);
|
item.DateLastRefreshed = default(DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libraryOptions == null)
|
|
||||||
{
|
|
||||||
libraryOptions = LibraryManager.GetLibraryOptions((BaseItem)item);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save to database
|
// Save to database
|
||||||
await SaveItem(metadataResult, libraryOptions, updateType, cancellationToken).ConfigureAwait(false);
|
await SaveItem(metadataResult, libraryOptions, updateType, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.696</version>
|
<version>3.0.697</version>
|
||||||
<title>Emby.Common</title>
|
<title>Emby.Common</title>
|
||||||
<authors>Emby Team</authors>
|
<authors>Emby Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.696</version>
|
<version>3.0.697</version>
|
||||||
<title>Emby.Server.Core</title>
|
<title>Emby.Server.Core</title>
|
||||||
<authors>Emby Team</authors>
|
<authors>Emby Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user