jellyfin-server/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs

69 lines
2.1 KiB
C#
Raw Normal View History

#nullable disable
#pragma warning disable CA1819, CS1591
using System;
2018-12-27 23:27:57 +00:00
using System.Linq;
2021-12-20 12:31:07 +00:00
using Jellyfin.Extensions;
2018-12-27 23:27:57 +00:00
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)
{
RefreshPaths ??= Array.Empty<string>();
2018-12-27 23:27:57 +00:00
RefreshPaths = copy.RefreshPaths.ToArray();
}
}
/// <summary>
/// Gets or sets a value indicating whether all existing data should be overwritten with new data from providers
/// when paired with MetadataRefreshMode=FullRefresh.
/// </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 23:27:57 +00:00
public bool RefreshItem(BaseItem item)
{
if (RefreshPaths != null && RefreshPaths.Length > 0)
{
2021-12-20 12:31:07 +00:00
return RefreshPaths.Contains(item.Path ?? string.Empty, StringComparison.OrdinalIgnoreCase);
2018-12-27 23:27:57 +00:00
}
return true;
}
}
}