| | | 1 | | #nullable disable |
| | | 2 | | |
| | | 3 | | #pragma warning disable CA1819, CS1591 |
| | | 4 | | |
| | | 5 | | using System; |
| | | 6 | | using System.Linq; |
| | | 7 | | using Jellyfin.Extensions; |
| | | 8 | | using MediaBrowser.Controller.Entities; |
| | | 9 | | using MediaBrowser.Model.Providers; |
| | | 10 | | |
| | | 11 | | namespace MediaBrowser.Controller.Providers |
| | | 12 | | { |
| | | 13 | | public class MetadataRefreshOptions : ImageRefreshOptions |
| | | 14 | | { |
| | | 15 | | public MetadataRefreshOptions(IDirectoryService directoryService) |
| | 115 | 16 | | : base(directoryService) |
| | | 17 | | { |
| | 115 | 18 | | MetadataRefreshMode = MetadataRefreshMode.Default; |
| | 115 | 19 | | } |
| | | 20 | | |
| | | 21 | | public MetadataRefreshOptions(MetadataRefreshOptions copy) |
| | 0 | 22 | | : base(copy.DirectoryService) |
| | | 23 | | { |
| | 0 | 24 | | MetadataRefreshMode = copy.MetadataRefreshMode; |
| | 0 | 25 | | ForceSave = copy.ForceSave; |
| | 0 | 26 | | ReplaceAllMetadata = copy.ReplaceAllMetadata; |
| | 0 | 27 | | EnableRemoteContentProbe = copy.EnableRemoteContentProbe; |
| | | 28 | | |
| | 0 | 29 | | IsAutomated = copy.IsAutomated; |
| | 0 | 30 | | ImageRefreshMode = copy.ImageRefreshMode; |
| | 0 | 31 | | ReplaceAllImages = copy.ReplaceAllImages; |
| | 0 | 32 | | RegenerateTrickplay = copy.RegenerateTrickplay; |
| | 0 | 33 | | ReplaceImages = copy.ReplaceImages; |
| | 0 | 34 | | SearchResult = copy.SearchResult; |
| | 0 | 35 | | RemoveOldMetadata = copy.RemoveOldMetadata; |
| | | 36 | | |
| | 0 | 37 | | if (copy.RefreshPaths is not null && copy.RefreshPaths.Length > 0) |
| | | 38 | | { |
| | 0 | 39 | | RefreshPaths ??= Array.Empty<string>(); |
| | | 40 | | |
| | 0 | 41 | | RefreshPaths = copy.RefreshPaths.ToArray(); |
| | | 42 | | } |
| | 0 | 43 | | } |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Gets or sets a value indicating whether all existing data should be overwritten with new data from providers |
| | | 47 | | /// when paired with MetadataRefreshMode=FullRefresh. |
| | | 48 | | /// </summary> |
| | | 49 | | public bool ReplaceAllMetadata { get; set; } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Gets or sets a value indicating whether all existing trickplay images should be overwritten |
| | | 53 | | /// when paired with MetadataRefreshMode=FullRefresh. |
| | | 54 | | /// </summary> |
| | | 55 | | public bool RegenerateTrickplay { get; set; } |
| | | 56 | | |
| | | 57 | | public MetadataRefreshMode MetadataRefreshMode { get; set; } |
| | | 58 | | |
| | | 59 | | public RemoteSearchResult SearchResult { get; set; } |
| | | 60 | | |
| | | 61 | | public string[] RefreshPaths { get; set; } |
| | | 62 | | |
| | | 63 | | public bool ForceSave { get; set; } |
| | | 64 | | |
| | | 65 | | public bool EnableRemoteContentProbe { get; set; } |
| | | 66 | | |
| | | 67 | | public bool RefreshItem(BaseItem item) |
| | | 68 | | { |
| | 8 | 69 | | if (RefreshPaths is not null && RefreshPaths.Length > 0) |
| | | 70 | | { |
| | 0 | 71 | | return RefreshPaths.Contains(item.Path ?? string.Empty, StringComparison.OrdinalIgnoreCase); |
| | | 72 | | } |
| | | 73 | | |
| | 8 | 74 | | return true; |
| | | 75 | | } |
| | | 76 | | } |
| | | 77 | | } |