using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Providers
{
public class MetadataRefreshOptions : ImageRefreshOptions
{
///
/// When paired with MetadataRefreshMode=FullRefresh, all existing data will be overwritten with new data from the providers.
///
public bool ReplaceAllMetadata { get; set; }
public MetadataRefreshMode MetadataRefreshMode { get; set; }
public bool ForceSave { get; set; }
public MetadataRefreshOptions()
{
MetadataRefreshMode = MetadataRefreshMode.Default;
}
public MetadataRefreshOptions(MetadataRefreshOptions copy)
{
MetadataRefreshMode = copy.MetadataRefreshMode;
ForceSave = copy.ForceSave;
ReplaceAllMetadata = copy.ReplaceAllMetadata;
ImageRefreshMode = copy.ImageRefreshMode;
DirectoryService = copy.DirectoryService;
ReplaceAllImages = copy.ReplaceAllImages;
ReplaceImages = copy.ReplaceImages.ToList();
}
}
public class ImageRefreshOptions
{
public ImageRefreshMode ImageRefreshMode { get; set; }
public IDirectoryService DirectoryService { get; set; }
public bool ReplaceAllImages { get; set; }
public List ReplaceImages { get; set; }
public ImageRefreshOptions()
{
ImageRefreshMode = ImageRefreshMode.Default;
ReplaceImages = new List();
}
public bool IsReplacingImage(ImageType type)
{
return ImageRefreshMode == ImageRefreshMode.FullRefresh &&
(ReplaceAllImages || ReplaceImages.Contains(type));
}
}
public enum MetadataRefreshMode
{
///
/// The none
///
None = 0,
///
/// The validation only
///
ValidationOnly = 1,
///
/// Providers will be executed based on default rules
///
Default = 2,
///
/// All providers will be executed to search for new metadata
///
FullRefresh = 3
}
public enum ImageRefreshMode
{
///
/// The none
///
None = 0,
///
/// The default
///
Default = 1,
///
/// Existing images will be validated
///
ValidationOnly = 2,
///
/// All providers will be executed to search for new metadata
///
FullRefresh = 3
}
}