2019-01-13 20:02:23 +00:00
|
|
|
using System.Collections.Generic;
|
2019-01-13 19:25:45 +00:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2014-02-08 20:02:35 +00:00
|
|
|
using MediaBrowser.Controller.Providers;
|
2016-10-25 19:02:04 +00:00
|
|
|
using MediaBrowser.Model.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
|
|
|
{
|
2020-06-14 02:04:53 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Collection folder local image provider.
|
|
|
|
/// </summary>
|
2020-03-09 15:10:02 +00:00
|
|
|
public class CollectionFolderLocalImageProvider : ILocalImageProvider, IHasOrder
|
2014-02-08 20:02:35 +00:00
|
|
|
{
|
2014-07-26 17:30:15 +00:00
|
|
|
private readonly IFileSystem _fileSystem;
|
|
|
|
|
2020-06-14 02:04:53 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="CollectionFolderLocalImageProvider"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
|
2014-07-26 17:30:15 +00:00
|
|
|
public CollectionFolderLocalImageProvider(IFileSystem fileSystem)
|
|
|
|
{
|
|
|
|
_fileSystem = fileSystem;
|
|
|
|
}
|
|
|
|
|
2020-06-14 02:04:53 +00:00
|
|
|
/// <inheritdoc />
|
2019-01-13 20:31:14 +00:00
|
|
|
public string Name => "Collection Folder Images";
|
2014-02-08 20:02:35 +00:00
|
|
|
|
2020-06-14 02:04:53 +00:00
|
|
|
/// Run after LocalImageProvider
|
|
|
|
/// <inheritdoc />
|
|
|
|
public int Order => 1;
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2018-09-12 17:26:21 +00:00
|
|
|
public bool Supports(BaseItem item)
|
2014-02-08 20:02:35 +00:00
|
|
|
{
|
2014-02-10 20:11:46 +00:00
|
|
|
return item is CollectionFolder && item.SupportsLocalMetadata;
|
2014-02-08 20:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-06-14 02:04:53 +00:00
|
|
|
/// <inheritdoc />
|
2021-03-09 04:57:38 +00:00
|
|
|
public IEnumerable<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService)
|
2014-02-08 20:02:35 +00:00
|
|
|
{
|
|
|
|
var collectionFolder = (CollectionFolder)item;
|
|
|
|
|
2020-06-14 02:04:53 +00:00
|
|
|
return new LocalImageProvider(_fileSystem).GetImages(item, collectionFolder.PhysicalLocations, directoryService);
|
2014-02-08 20:02:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|