ILocalImageProvider.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using MediaBrowser.Controller.Drawing;
  2. using MediaBrowser.Controller.Entities;
  3. using MediaBrowser.Model.Entities;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Threading;
  7. using System.Threading.Tasks;
  8. namespace MediaBrowser.Controller.Providers
  9. {
  10. /// <summary>
  11. /// This is just a marker interface
  12. /// </summary>
  13. public interface ILocalImageProvider : IImageProvider
  14. {
  15. }
  16. public interface IImageFileProvider : ILocalImageProvider
  17. {
  18. List<LocalImageInfo> GetImages(IHasImages item);
  19. }
  20. public class LocalImageInfo
  21. {
  22. public FileInfo FileInfo { get; set; }
  23. public ImageType Type { get; set; }
  24. }
  25. public interface IDynamicImageProvider : IImageProvider
  26. {
  27. /// <summary>
  28. /// Gets the supported images.
  29. /// </summary>
  30. /// <param name="item">The item.</param>
  31. /// <returns>IEnumerable{ImageType}.</returns>
  32. IEnumerable<ImageType> GetSupportedImages(IHasImages item);
  33. /// <summary>
  34. /// Gets the image.
  35. /// </summary>
  36. /// <param name="item">The item.</param>
  37. /// <param name="type">The type.</param>
  38. /// <param name="cancellationToken">The cancellation token.</param>
  39. /// <returns>Task{DynamicImageResponse}.</returns>
  40. Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken);
  41. }
  42. public class DynamicImageInfo
  43. {
  44. public string ImageId { get; set; }
  45. public ImageType Type { get; set; }
  46. }
  47. public class DynamicImageResponse
  48. {
  49. public string Path { get; set; }
  50. public Stream Stream { get; set; }
  51. public ImageFormat Format { get; set; }
  52. public bool HasImage { get; set; }
  53. public void SetFormatFromMimeType(string mimeType)
  54. {
  55. }
  56. }
  57. }