2020-08-22 19:56:24 +00:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 20:01:16 +00:00
|
|
|
using System;
|
2018-12-27 23:27:57 +00:00
|
|
|
using System.Linq;
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
using MediaBrowser.Model.Providers;
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
{
|
|
|
|
public class MetadataRefreshOptions : ImageRefreshOptions
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// When paired with MetadataRefreshMode=FullRefresh, all existing data will be overwritten with new data from the providers.
|
|
|
|
/// </summary>
|
|
|
|
public bool ReplaceAllMetadata { get; set; }
|
|
|
|
|
|
|
|
public MetadataRefreshMode MetadataRefreshMode { get; set; }
|
2020-03-09 14:05:03 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public RemoteSearchResult SearchResult { get; set; }
|
|
|
|
|
|
|
|
public string[] RefreshPaths { get; set; }
|
|
|
|
|
|
|
|
public bool ForceSave { get; set; }
|
2020-03-09 14:05:03 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public bool EnableRemoteContentProbe { get; set; }
|
|
|
|
|
|
|
|
public MetadataRefreshOptions(IDirectoryService directoryService)
|
|
|
|
: base(directoryService)
|
|
|
|
{
|
|
|
|
MetadataRefreshMode = MetadataRefreshMode.Default;
|
|
|
|
}
|
|
|
|
|
|
|
|
public MetadataRefreshOptions(MetadataRefreshOptions copy)
|
|
|
|
: base(copy.DirectoryService)
|
|
|
|
{
|
|
|
|
MetadataRefreshMode = copy.MetadataRefreshMode;
|
|
|
|
ForceSave = copy.ForceSave;
|
|
|
|
ReplaceAllMetadata = copy.ReplaceAllMetadata;
|
|
|
|
EnableRemoteContentProbe = copy.EnableRemoteContentProbe;
|
|
|
|
|
|
|
|
ImageRefreshMode = copy.ImageRefreshMode;
|
|
|
|
ReplaceAllImages = copy.ReplaceAllImages;
|
|
|
|
ReplaceImages = copy.ReplaceImages;
|
|
|
|
SearchResult = copy.SearchResult;
|
|
|
|
|
|
|
|
if (copy.RefreshPaths != null && copy.RefreshPaths.Length > 0)
|
|
|
|
{
|
2021-05-05 11:51:14 +00:00
|
|
|
RefreshPaths ??= Array.Empty<string>();
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
RefreshPaths = copy.RefreshPaths.ToArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool RefreshItem(BaseItem item)
|
|
|
|
{
|
|
|
|
if (RefreshPaths != null && RefreshPaths.Length > 0)
|
|
|
|
{
|
|
|
|
return RefreshPaths.Contains(item.Path ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|