2021-05-06 18:39:20 -04:00
|
|
|
#nullable disable
|
|
|
|
|
2021-07-23 12:16:48 -04:00
|
|
|
#pragma warning disable CA1819, CS1591
|
2020-08-22 15:56:24 -04:00
|
|
|
|
2019-01-13 15:01:16 -05:00
|
|
|
using System;
|
2018-12-27 18:27:57 -05:00
|
|
|
using System.Linq;
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
using MediaBrowser.Model.Providers;
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
{
|
|
|
|
public class MetadataRefreshOptions : ImageRefreshOptions
|
|
|
|
{
|
|
|
|
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 07:51:14 -04:00
|
|
|
RefreshPaths ??= Array.Empty<string>();
|
2018-12-27 18:27:57 -05:00
|
|
|
|
|
|
|
RefreshPaths = copy.RefreshPaths.ToArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-11 07:55:46 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets a value indicating whether all existing data should be overwritten with new data from providers
|
2021-05-13 09:32:02 -04:00
|
|
|
/// when paired with MetadataRefreshMode=FullRefresh.
|
2021-05-11 07:55:46 -04:00
|
|
|
/// </summary>
|
|
|
|
public bool ReplaceAllMetadata { get; set; }
|
|
|
|
|
|
|
|
public MetadataRefreshMode MetadataRefreshMode { get; set; }
|
|
|
|
|
|
|
|
public RemoteSearchResult SearchResult { get; set; }
|
|
|
|
|
|
|
|
public string[] RefreshPaths { get; set; }
|
|
|
|
|
|
|
|
public bool ForceSave { get; set; }
|
|
|
|
|
|
|
|
public bool EnableRemoteContentProbe { get; set; }
|
|
|
|
|
2018-12-27 18:27:57 -05:00
|
|
|
public bool RefreshItem(BaseItem item)
|
|
|
|
{
|
|
|
|
if (RefreshPaths != null && RefreshPaths.Length > 0)
|
|
|
|
{
|
|
|
|
return RefreshPaths.Contains(item.Path ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|