2014-02-08 13:02:35 -07:00
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
|
using MediaBrowser.Controller.Entities;
|
2014-02-08 21:52:52 -07:00
|
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
2014-02-08 13:02:35 -07:00
|
|
|
|
using MediaBrowser.Controller.Providers;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Providers.All
|
|
|
|
|
{
|
|
|
|
|
public class InternalMetadataFolderImageProvider : ILocalImageFileProvider, IHasOrder
|
|
|
|
|
{
|
|
|
|
|
private readonly IServerConfigurationManager _config;
|
|
|
|
|
|
|
|
|
|
public InternalMetadataFolderImageProvider(IServerConfigurationManager config)
|
|
|
|
|
{
|
|
|
|
|
_config = config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "Internal Images"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Supports(IHasImages item)
|
|
|
|
|
{
|
|
|
|
|
if (!item.IsSaveLocalMetadataEnabled())
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-08 21:52:52 -07:00
|
|
|
|
// Extracted images will be saved in here
|
|
|
|
|
if (item is Audio)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-10 13:11:46 -07:00
|
|
|
|
if (item.SupportsLocalMetadata)
|
2014-02-08 13:02:35 -07:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Order
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
// Make sure this is last so that all other locations are scanned first
|
|
|
|
|
return 1000;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-10 11:39:41 -07:00
|
|
|
|
public List<LocalImageInfo> GetImages(IHasImages item, IDirectoryService directoryService)
|
2014-02-08 13:02:35 -07:00
|
|
|
|
{
|
|
|
|
|
var path = _config.ApplicationPaths.GetInternalMetadataPath(item.Id);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2014-02-08 15:38:02 -07:00
|
|
|
|
return new LocalImageProvider().GetImages(item, path, directoryService);
|
2014-02-08 13:02:35 -07:00
|
|
|
|
}
|
|
|
|
|
catch (DirectoryNotFoundException)
|
|
|
|
|
{
|
|
|
|
|
return new List<LocalImageInfo>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|