CollectionFolderLocalImageProvider.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System.Collections.Generic;
  2. using MediaBrowser.Controller.Entities;
  3. using MediaBrowser.Controller.Providers;
  4. using MediaBrowser.Model.IO;
  5. namespace MediaBrowser.LocalMetadata.Images
  6. {
  7. /// <summary>
  8. /// Collection folder local image provider.
  9. /// </summary>
  10. public class CollectionFolderLocalImageProvider : ILocalImageProvider, IHasOrder
  11. {
  12. private readonly IFileSystem _fileSystem;
  13. /// <summary>
  14. /// Initializes a new instance of the <see cref="CollectionFolderLocalImageProvider"/> class.
  15. /// </summary>
  16. /// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
  17. public CollectionFolderLocalImageProvider(IFileSystem fileSystem)
  18. {
  19. _fileSystem = fileSystem;
  20. }
  21. /// <inheritdoc />
  22. public string Name => "Collection Folder Images";
  23. /// Run after LocalImageProvider
  24. /// <inheritdoc />
  25. public int Order => 1;
  26. /// <inheritdoc />
  27. public bool Supports(BaseItem item)
  28. {
  29. return item is CollectionFolder && item.SupportsLocalMetadata;
  30. }
  31. /// <inheritdoc />
  32. public IEnumerable<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService)
  33. {
  34. var collectionFolder = (CollectionFolder)item;
  35. return new LocalImageProvider(_fileSystem).GetImages(item, collectionFolder.PhysicalLocations, directoryService);
  36. }
  37. }
  38. }