jellyfin/MediaBrowser.Controller/Providers/ImageRefreshOptions.cs

43 lines
1.2 KiB
C#
Raw Normal View History

#pragma warning disable CA1819, CS1591
2018-12-27 23:27:57 +00:00
using System;
using System.Collections.Generic;
2018-12-27 23:27:57 +00:00
using System.Linq;
using MediaBrowser.Model.Entities;
2018-12-27 23:27:57 +00:00
namespace MediaBrowser.Controller.Providers
{
public class ImageRefreshOptions
{
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 IReadOnlyList<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; }
/// <summary>
/// Gets or sets a value indicating whether old metadata should be removed if it isn't replaced.
/// </summary>
public bool RemoveOldMetadata { get; set; }
2018-12-27 23:27:57 +00:00
public bool IsReplacingImage(ImageType type)
{
return ImageRefreshMode == MetadataRefreshMode.FullRefresh
&& (ReplaceAllImages || ReplaceImages.Contains(type));
2018-12-27 23:27:57 +00:00
}
}
2018-12-27 21:43:48 +00:00
}