2017-09-18 18:52:22 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using MediaBrowser.Controller.Entities;
|
2016-10-25 21:02:04 +02:00
|
|
|
|
using MediaBrowser.Controller.IO;
|
|
|
|
|
using MediaBrowser.Model.IO;
|
2016-08-06 06:48:00 +02:00
|
|
|
|
using MediaBrowser.Model.Logging;
|
2016-04-06 04:18:56 +02:00
|
|
|
|
using MediaBrowser.Model.Providers;
|
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; }
|
|
|
|
|
|
2015-01-28 22:29:02 +01:00
|
|
|
|
public bool IsPostRecursiveRefresh { get; set; }
|
2017-05-27 09:19:09 +02:00
|
|
|
|
public bool ValidateChildren { get; set; }
|
2015-03-11 03:07:07 +01:00
|
|
|
|
|
2014-01-28 19:37:01 +01:00
|
|
|
|
public MetadataRefreshMode MetadataRefreshMode { get; set; }
|
2016-04-06 04:18:56 +02:00
|
|
|
|
public RemoteSearchResult SearchResult { get; set; }
|
2014-01-28 19:37:01 +01:00
|
|
|
|
|
2017-09-18 18:52:22 +02:00
|
|
|
|
public List<string> RefreshPaths { get; set; }
|
|
|
|
|
|
2014-01-28 19:37:01 +01:00
|
|
|
|
public bool ForceSave { get; set; }
|
2014-07-04 04:22:57 +02:00
|
|
|
|
|
2015-09-13 23:32:02 +02:00
|
|
|
|
public MetadataRefreshOptions(IFileSystem fileSystem)
|
2016-08-06 06:48:00 +02:00
|
|
|
|
: this(new DirectoryService(new NullLogger(), fileSystem))
|
2014-10-25 20:32:58 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2015-03-11 03:07:07 +01:00
|
|
|
|
public MetadataRefreshOptions(MetadataRefreshOptions copy)
|
2014-10-25 20:32:58 +02:00
|
|
|
|
: 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();
|
2016-04-06 04:18:56 +02:00
|
|
|
|
SearchResult = copy.SearchResult;
|
2017-09-18 18:52:22 +02:00
|
|
|
|
|
|
|
|
|
if (copy.RefreshPaths != null && copy.RefreshPaths.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (RefreshPaths == null)
|
|
|
|
|
{
|
|
|
|
|
RefreshPaths = new List<string>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RefreshPaths.AddRange(copy.RefreshPaths);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool RefreshItem(BaseItem item)
|
|
|
|
|
{
|
|
|
|
|
if (RefreshPaths != null && RefreshPaths.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return RefreshPaths.Contains(item.Path ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
2014-08-26 04:30:52 +02:00
|
|
|
|
}
|
2014-01-28 19:37:01 +01:00
|
|
|
|
}
|
|
|
|
|
}
|