2021-07-23 16:16:48 +00:00
|
|
|
#pragma warning disable CA1819, CS1591
|
2020-08-22 19:56:24 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
2019-01-13 19:25:32 +00:00
|
|
|
using MediaBrowser.Model.Entities;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
{
|
|
|
|
public class ImageRefreshOptions
|
|
|
|
{
|
2021-07-23 16:16:48 +00:00
|
|
|
public ImageRefreshOptions(IDirectoryService directoryService)
|
|
|
|
{
|
|
|
|
ImageRefreshMode = MetadataRefreshMode.Default;
|
|
|
|
DirectoryService = directoryService;
|
|
|
|
|
|
|
|
ReplaceImages = Array.Empty<ImageType>();
|
|
|
|
IsAutomated = true;
|
|
|
|
}
|
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public MetadataRefreshMode ImageRefreshMode { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public IDirectoryService DirectoryService { get; private set; }
|
|
|
|
|
|
|
|
public bool ReplaceAllImages { get; set; }
|
|
|
|
|
|
|
|
public ImageType[] ReplaceImages { get; set; }
|
2020-06-15 21:43:52 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public bool IsAutomated { get; set; }
|
|
|
|
|
2021-12-31 16:05:02 +00:00
|
|
|
/// <summary>
|
2022-01-13 22:21:02 +00:00
|
|
|
/// Gets or sets a value indicating whether old metadata should be removed if it isn't replaced.
|
2021-12-31 16:05:02 +00:00
|
|
|
/// </summary>
|
2022-01-08 13:03:59 +00:00
|
|
|
public bool RemoveOldMetadata { get; set; }
|
2021-12-31 16:05:02 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
public bool IsReplacingImage(ImageType type)
|
|
|
|
{
|
2022-06-14 17:11:37 +00:00
|
|
|
return ImageRefreshMode == MetadataRefreshMode.FullRefresh
|
|
|
|
&& (ReplaceAllImages || ReplaceImages.Contains(type));
|
2018-12-27 23:27:57 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-27 21:43:48 +00:00
|
|
|
}
|