| | 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 | | { |
| 156 | 14 | | ImageRefreshMode = MetadataRefreshMode.Default; |
| 156 | 15 | | DirectoryService = directoryService; |
| | 16 | |
|
| 156 | 17 | | ReplaceImages = Array.Empty<ImageType>(); |
| 156 | 18 | | IsAutomated = true; |
| 156 | 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 | | } |