You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs

71 lines
2.2 KiB

#nullable disable
#pragma warning disable CA1819, CS1591
using System;
6 years ago
using System.Linq;
using Jellyfin.Extensions;
6 years ago
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;
IsAutomated = copy.IsAutomated;
6 years ago
ImageRefreshMode = copy.ImageRefreshMode;
ReplaceAllImages = copy.ReplaceAllImages;
ReplaceImages = copy.ReplaceImages;
SearchResult = copy.SearchResult;
RemoveOldMetadata = copy.RemoveOldMetadata;
6 years ago
if (copy.RefreshPaths is not null && copy.RefreshPaths.Length > 0)
6 years ago
{
RefreshPaths ??= Array.Empty<string>();
6 years ago
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; }
6 years ago
public bool RefreshItem(BaseItem item)
{
if (RefreshPaths is not null && RefreshPaths.Length > 0)
6 years ago
{
return RefreshPaths.Contains(item.Path ?? string.Empty, StringComparison.OrdinalIgnoreCase);
6 years ago
}
return true;
}
}
}