| | | 1 | | #pragma warning disable CA1819, CS1591 |
| | | 2 | | |
| | | 3 | | using System; |
| | | 4 | | using System.Collections.Generic; |
| | | 5 | | using System.Linq; |
| | | 6 | | using MediaBrowser.Model.Entities; |
| | | 7 | | |
| | | 8 | | namespace MediaBrowser.Controller.Providers |
| | | 9 | | { |
| | | 10 | | public class ImageRefreshOptions |
| | | 11 | | { |
| | | 12 | | public ImageRefreshOptions(IDirectoryService directoryService) |
| | | 13 | | { |
| | 168 | 14 | | ImageRefreshMode = MetadataRefreshMode.Default; |
| | 168 | 15 | | DirectoryService = directoryService; |
| | | 16 | | |
| | 168 | 17 | | ReplaceImages = Array.Empty<ImageType>(); |
| | 168 | 18 | | IsAutomated = true; |
| | 168 | 19 | | } |
| | | 20 | | |
| | | 21 | | public MetadataRefreshMode ImageRefreshMode { get; set; } |
| | | 22 | | |
| | | 23 | | public IDirectoryService DirectoryService { get; private set; } |
| | | 24 | | |
| | | 25 | | public bool ReplaceAllImages { get; set; } |
| | | 26 | | |
| | | 27 | | public IReadOnlyList<ImageType> ReplaceImages { get; set; } |
| | | 28 | | |
| | | 29 | | public bool IsAutomated { get; set; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Gets or sets a value indicating whether old metadata should be removed if it isn't replaced. |
| | | 33 | | /// </summary> |
| | | 34 | | public bool RemoveOldMetadata { get; set; } |
| | | 35 | | |
| | | 36 | | public bool IsReplacingImage(ImageType type) |
| | | 37 | | { |
| | 36 | 38 | | return ImageRefreshMode == MetadataRefreshMode.FullRefresh |
| | 36 | 39 | | && (ReplaceAllImages || ReplaceImages.Contains(type)); |
| | | 40 | | } |
| | | 41 | | } |
| | | 42 | | } |