IProviderManager.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Controller.Library;
  3. using MediaBrowser.Model.Configuration;
  4. using MediaBrowser.Model.Entities;
  5. using MediaBrowser.Model.Providers;
  6. using System.Collections.Generic;
  7. using System.IO;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. namespace MediaBrowser.Controller.Providers
  11. {
  12. /// <summary>
  13. /// Interface IProviderManager
  14. /// </summary>
  15. public interface IProviderManager
  16. {
  17. /// <summary>
  18. /// Refreshes the metadata.
  19. /// </summary>
  20. /// <param name="item">The item.</param>
  21. /// <param name="options">The options.</param>
  22. /// <param name="cancellationToken">The cancellation token.</param>
  23. /// <returns>Task.</returns>
  24. Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions options, CancellationToken cancellationToken);
  25. /// <summary>
  26. /// Executes the metadata providers.
  27. /// </summary>
  28. /// <param name="item">The item.</param>
  29. /// <param name="cancellationToken">The cancellation token.</param>
  30. /// <param name="force">if set to <c>true</c> [force].</param>
  31. /// <returns>Task{System.Boolean}.</returns>
  32. Task<ItemUpdateType?> ExecuteMetadataProviders(BaseItem item, CancellationToken cancellationToken, bool force = false);
  33. /// <summary>
  34. /// Saves the image.
  35. /// </summary>
  36. /// <param name="item">The item.</param>
  37. /// <param name="url">The URL.</param>
  38. /// <param name="resourcePool">The resource pool.</param>
  39. /// <param name="type">The type.</param>
  40. /// <param name="imageIndex">Index of the image.</param>
  41. /// <param name="cancellationToken">The cancellation token.</param>
  42. /// <returns>Task.</returns>
  43. Task SaveImage(BaseItem item, string url, SemaphoreSlim resourcePool, ImageType type, int? imageIndex, CancellationToken cancellationToken);
  44. /// <summary>
  45. /// Saves the image.
  46. /// </summary>
  47. /// <param name="item">The item.</param>
  48. /// <param name="source">The source.</param>
  49. /// <param name="mimeType">Type of the MIME.</param>
  50. /// <param name="type">The type.</param>
  51. /// <param name="imageIndex">Index of the image.</param>
  52. /// <param name="sourceUrl">The source URL.</param>
  53. /// <param name="cancellationToken">The cancellation token.</param>
  54. /// <returns>Task.</returns>
  55. Task SaveImage(BaseItem item, Stream source, string mimeType, ImageType type, int? imageIndex, string sourceUrl, CancellationToken cancellationToken);
  56. /// <summary>
  57. /// Adds the metadata providers.
  58. /// </summary>
  59. /// <param name="providers">The providers.</param>
  60. /// <param name="imageProviders">The image providers.</param>
  61. /// <param name="metadataServices">The metadata services.</param>
  62. /// <param name="metadataProviders">The metadata providers.</param>
  63. /// <param name="savers">The savers.</param>
  64. void AddParts(IEnumerable<BaseMetadataProvider> providers, IEnumerable<IImageProvider> imageProviders, IEnumerable<IMetadataService> metadataServices, IEnumerable<IMetadataProvider> metadataProviders,
  65. IEnumerable<IMetadataSaver> savers);
  66. /// <summary>
  67. /// Gets the available remote images.
  68. /// </summary>
  69. /// <param name="item">The item.</param>
  70. /// <param name="cancellationToken">The cancellation token.</param>
  71. /// <param name="providerName">Name of the provider.</param>
  72. /// <param name="type">The type.</param>
  73. /// <returns>Task{IEnumerable{RemoteImageInfo}}.</returns>
  74. Task<IEnumerable<RemoteImageInfo>> GetAvailableRemoteImages(IHasImages item, CancellationToken cancellationToken, string providerName = null, ImageType? type = null);
  75. /// <summary>
  76. /// Gets the image providers.
  77. /// </summary>
  78. /// <param name="item">The item.</param>
  79. /// <returns>IEnumerable{ImageProviderInfo}.</returns>
  80. IEnumerable<ImageProviderInfo> GetImageProviderInfo(IHasImages item);
  81. /// <summary>
  82. /// Gets all metadata plugins.
  83. /// </summary>
  84. /// <returns>IEnumerable{MetadataPlugin}.</returns>
  85. IEnumerable<MetadataPluginSummary> GetAllMetadataPlugins();
  86. /// <summary>
  87. /// Saves the metadata.
  88. /// </summary>
  89. /// <param name="item">The item.</param>
  90. /// <param name="updateType">Type of the update.</param>
  91. /// <returns>Task.</returns>
  92. Task SaveMetadata(IHasMetadata item, ItemUpdateType updateType);
  93. }
  94. }