2014-07-04 04:22:57 +02:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
2014-06-13 16:24:14 +02:00
|
|
|
|
using System.Collections.Generic;
|
2014-08-26 04:30:52 +02:00
|
|
|
|
using System.Linq;
|
2014-01-28 19:37:01 +01:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
|
{
|
|
|
|
|
public class MetadataRefreshOptions : ImageRefreshOptions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// When paired with MetadataRefreshMode=FullRefresh, all existing data will be overwritten with new data from the providers.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool ReplaceAllMetadata { get; set; }
|
|
|
|
|
|
|
|
|
|
public MetadataRefreshMode MetadataRefreshMode { get; set; }
|
|
|
|
|
|
|
|
|
|
public bool ForceSave { get; set; }
|
2014-07-04 04:22:57 +02:00
|
|
|
|
|
|
|
|
|
public MetadataRefreshOptions()
|
2014-10-25 20:32:58 +02:00
|
|
|
|
: this(new DirectoryService())
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MetadataRefreshOptions(IDirectoryService directoryService)
|
|
|
|
|
: base(directoryService)
|
2014-07-04 04:22:57 +02:00
|
|
|
|
{
|
|
|
|
|
MetadataRefreshMode = MetadataRefreshMode.Default;
|
|
|
|
|
}
|
2014-08-26 04:30:52 +02:00
|
|
|
|
|
2014-10-25 20:32:58 +02:00
|
|
|
|
public MetadataRefreshOptions( MetadataRefreshOptions copy)
|
|
|
|
|
: base(copy.DirectoryService)
|
2014-08-26 04:30:52 +02:00
|
|
|
|
{
|
|
|
|
|
MetadataRefreshMode = copy.MetadataRefreshMode;
|
|
|
|
|
ForceSave = copy.ForceSave;
|
|
|
|
|
ReplaceAllMetadata = copy.ReplaceAllMetadata;
|
|
|
|
|
|
|
|
|
|
ImageRefreshMode = copy.ImageRefreshMode;
|
|
|
|
|
ReplaceAllImages = copy.ReplaceAllImages;
|
|
|
|
|
ReplaceImages = copy.ReplaceImages.ToList();
|
|
|
|
|
}
|
2014-01-28 19:37:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ImageRefreshOptions
|
|
|
|
|
{
|
2014-01-31 05:50:09 +01:00
|
|
|
|
public ImageRefreshMode ImageRefreshMode { get; set; }
|
2014-10-25 20:32:58 +02:00
|
|
|
|
public IDirectoryService DirectoryService { get; private set; }
|
2014-01-31 05:50:09 +01:00
|
|
|
|
|
2014-06-13 16:24:14 +02:00
|
|
|
|
public bool ReplaceAllImages { get; set; }
|
|
|
|
|
|
|
|
|
|
public List<ImageType> ReplaceImages { get; set; }
|
|
|
|
|
|
2014-10-25 20:32:58 +02:00
|
|
|
|
public ImageRefreshOptions(IDirectoryService directoryService)
|
2014-01-31 05:50:09 +01:00
|
|
|
|
{
|
|
|
|
|
ImageRefreshMode = ImageRefreshMode.Default;
|
2014-10-25 20:32:58 +02:00
|
|
|
|
DirectoryService = directoryService;
|
2014-06-13 16:24:14 +02:00
|
|
|
|
|
|
|
|
|
ReplaceImages = new List<ImageType>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsReplacingImage(ImageType type)
|
|
|
|
|
{
|
2014-07-04 04:22:57 +02:00
|
|
|
|
return ImageRefreshMode == ImageRefreshMode.FullRefresh &&
|
|
|
|
|
(ReplaceAllImages || ReplaceImages.Contains(type));
|
2014-01-31 05:50:09 +01:00
|
|
|
|
}
|
2014-01-28 19:37:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum MetadataRefreshMode
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
/// The none
|
2014-01-28 19:37:01 +01:00
|
|
|
|
/// </summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
None = 0,
|
2014-01-28 19:37:01 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
/// The validation only
|
2014-01-28 19:37:01 +01:00
|
|
|
|
/// </summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
ValidationOnly = 1,
|
2014-01-28 19:37:01 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
/// Providers will be executed based on default rules
|
2014-01-28 19:37:01 +01:00
|
|
|
|
/// </summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
Default = 2,
|
2014-05-17 06:24:10 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
/// All providers will be executed to search for new metadata
|
2014-05-17 06:24:10 +02:00
|
|
|
|
/// </summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
FullRefresh = 3
|
2014-01-28 19:37:01 +01:00
|
|
|
|
}
|
2014-01-31 05:50:09 +01:00
|
|
|
|
|
|
|
|
|
public enum ImageRefreshMode
|
|
|
|
|
{
|
2014-07-04 04:22:57 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The none
|
|
|
|
|
/// </summary>
|
|
|
|
|
None = 0,
|
|
|
|
|
|
2014-01-31 05:50:09 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The default
|
|
|
|
|
/// </summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
Default = 1,
|
2014-01-31 05:50:09 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Existing images will be validated
|
|
|
|
|
/// </summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
ValidationOnly = 2,
|
2014-01-31 05:50:09 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// All providers will be executed to search for new metadata
|
|
|
|
|
/// </summary>
|
2014-07-04 04:22:57 +02:00
|
|
|
|
FullRefresh = 3
|
2014-01-31 05:50:09 +01:00
|
|
|
|
}
|
2014-01-28 19:37:01 +01:00
|
|
|
|
}
|