using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Providers
{
class ImageFromMixedMediaLocationProvider : BaseMetadataProvider
{
public ImageFromMixedMediaLocationProvider(ILogManager logManager, IServerConfigurationManager configurationManager)
: base(logManager, configurationManager)
{
}
public override ItemUpdateType ItemUpdateType
{
get
{
return ItemUpdateType.ImageUpdate;
}
}
///
/// Supportses the specified item.
///
/// The item.
/// true if XXXX, false otherwise
public override bool Supports(BaseItem item)
{
if (item.LocationType != LocationType.FileSystem || item.ResolveArgs.IsDirectory)
{
return false;
}
var video = item as Video;
if (video != null && !(item is Episode))
{
return video.IsInMixedFolder;
}
var game = item as Game;
if (game != null)
{
return game.IsInMixedFolder;
}
return false;
}
///
/// Gets the priority.
///
/// The priority.
public override MetadataProviderPriority Priority
{
get { return MetadataProviderPriority.First; }
}
///
/// Returns true or false indicating if the provider should refresh when the contents of it's directory changes
///
/// true if [refresh on file system stamp change]; otherwise, false.
protected override bool RefreshOnFileSystemStampChange
{
get
{
return true;
}
}
///
/// Gets the filestamp extensions.
///
/// The filestamp extensions.
protected override string[] FilestampExtensions
{
get
{
return BaseItem.SupportedImageExtensions;
}
}
public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
{
return TrueTaskResult;
}
}
}