2014-07-26 17:30:15 +00:00
|
|
|
|
using MediaBrowser.Common.IO;
|
2014-09-28 15:27:26 +00:00
|
|
|
|
using MediaBrowser.Controller.Channels;
|
2014-06-30 03:04:50 +00:00
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
2014-02-08 20:02:35 +00:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
2014-02-09 04:52:52 +00:00
|
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
2014-02-08 20:02:35 +00:00
|
|
|
|
using MediaBrowser.Controller.Providers;
|
2014-07-26 17:30:15 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2014-02-08 20:02:35 +00:00
|
|
|
|
|
2014-06-30 03:04:50 +00:00
|
|
|
|
namespace MediaBrowser.LocalMetadata.Images
|
2014-02-08 20:02:35 +00:00
|
|
|
|
{
|
|
|
|
|
public class InternalMetadataFolderImageProvider : ILocalImageFileProvider, IHasOrder
|
|
|
|
|
{
|
|
|
|
|
private readonly IServerConfigurationManager _config;
|
2014-07-26 17:30:15 +00:00
|
|
|
|
private readonly IFileSystem _fileSystem;
|
2014-02-08 20:02:35 +00:00
|
|
|
|
|
2014-07-26 17:30:15 +00:00
|
|
|
|
public InternalMetadataFolderImageProvider(IServerConfigurationManager config, IFileSystem fileSystem)
|
2014-02-08 20:02:35 +00:00
|
|
|
|
{
|
|
|
|
|
_config = config;
|
2014-07-26 17:30:15 +00:00
|
|
|
|
_fileSystem = fileSystem;
|
2014-02-08 20:02:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "Internal Images"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Supports(IHasImages item)
|
|
|
|
|
{
|
|
|
|
|
if (!item.IsSaveLocalMetadataEnabled())
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-09 04:52:52 +00:00
|
|
|
|
// Extracted images will be saved in here
|
|
|
|
|
if (item is Audio)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-10 20:11:46 +00:00
|
|
|
|
if (item.SupportsLocalMetadata)
|
2014-02-08 20:02:35 +00: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 18:39:41 +00:00
|
|
|
|
public List<LocalImageInfo> GetImages(IHasImages item, IDirectoryService directoryService)
|
2014-02-08 20:02:35 +00:00
|
|
|
|
{
|
2014-09-28 15:27:26 +00:00
|
|
|
|
var path = item.GetInternalMetadataPath();
|
|
|
|
|
|
|
|
|
|
if (item is IChannelItem)
|
|
|
|
|
{
|
|
|
|
|
var b = true;
|
|
|
|
|
}
|
2014-02-08 20:02:35 +00:00
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2014-07-26 17:30:15 +00:00
|
|
|
|
return new LocalImageProvider(_fileSystem).GetImages(item, path, directoryService);
|
2014-02-08 20:02:35 +00:00
|
|
|
|
}
|
|
|
|
|
catch (DirectoryNotFoundException)
|
|
|
|
|
{
|
|
|
|
|
return new List<LocalImageInfo>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|