IProviderManager.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using MediaBrowser.Common.Net;
  2. using MediaBrowser.Controller.Entities;
  3. using MediaBrowser.Controller.Library;
  4. using MediaBrowser.Model.Configuration;
  5. using MediaBrowser.Model.Entities;
  6. using MediaBrowser.Model.Providers;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.IO;
  10. using System.Threading;
  11. using System.Threading.Tasks;
  12. namespace MediaBrowser.Controller.Providers
  13. {
  14. /// <summary>
  15. /// Interface IProviderManager
  16. /// </summary>
  17. public interface IProviderManager
  18. {
  19. /// <summary>
  20. /// Queues the refresh.
  21. /// </summary>
  22. /// <param name="itemId">The item identifier.</param>
  23. /// <param name="options">The options.</param>
  24. void QueueRefresh(Guid itemId, MetadataRefreshOptions options);
  25. /// <summary>
  26. /// Refreshes the full item.
  27. /// </summary>
  28. /// <param name="item">The item.</param>
  29. /// <param name="options">The options.</param>
  30. /// <param name="cancellationToken">The cancellation token.</param>
  31. /// <returns>Task.</returns>
  32. Task RefreshFullItem(IHasMetadata item, MetadataRefreshOptions options, CancellationToken cancellationToken);
  33. /// <summary>
  34. /// Refreshes the metadata.
  35. /// </summary>
  36. /// <param name="item">The item.</param>
  37. /// <param name="options">The options.</param>
  38. /// <param name="cancellationToken">The cancellation token.</param>
  39. /// <returns>Task.</returns>
  40. Task<ItemUpdateType> RefreshSingleItem(IHasMetadata item, MetadataRefreshOptions options, CancellationToken cancellationToken);
  41. /// <summary>
  42. /// Saves the image.
  43. /// </summary>
  44. /// <param name="item">The item.</param>
  45. /// <param name="url">The URL.</param>
  46. /// <param name="resourcePool">The resource pool.</param>
  47. /// <param name="type">The type.</param>
  48. /// <param name="imageIndex">Index of the image.</param>
  49. /// <param name="cancellationToken">The cancellation token.</param>
  50. /// <returns>Task.</returns>
  51. Task SaveImage(IHasImages item, string url, SemaphoreSlim resourcePool, ImageType type, int? imageIndex, CancellationToken cancellationToken);
  52. /// <summary>
  53. /// Saves the image.
  54. /// </summary>
  55. /// <param name="item">The item.</param>
  56. /// <param name="source">The source.</param>
  57. /// <param name="mimeType">Type of the MIME.</param>
  58. /// <param name="type">The type.</param>
  59. /// <param name="imageIndex">Index of the image.</param>
  60. /// <param name="cancellationToken">The cancellation token.</param>
  61. /// <returns>Task.</returns>
  62. Task SaveImage(IHasImages item, Stream source, string mimeType, ImageType type, int? imageIndex, CancellationToken cancellationToken);
  63. /// <summary>
  64. /// Saves the image.
  65. /// </summary>
  66. /// <param name="item">The item.</param>
  67. /// <param name="source">The source.</param>
  68. /// <param name="mimeType">Type of the MIME.</param>
  69. /// <param name="type">The type.</param>
  70. /// <param name="imageIndex">Index of the image.</param>
  71. /// <param name="internalCacheKey">The internal cache key.</param>
  72. /// <param name="cancellationToken">The cancellation token.</param>
  73. /// <returns>Task.</returns>
  74. Task SaveImage(IHasImages item, Stream source, string mimeType, ImageType type, int? imageIndex, string internalCacheKey, CancellationToken cancellationToken);
  75. /// <summary>
  76. /// Saves the image.
  77. /// </summary>
  78. /// <param name="item">The item.</param>
  79. /// <param name="source">The source.</param>
  80. /// <param name="mimeType">Type of the MIME.</param>
  81. /// <param name="type">The type.</param>
  82. /// <param name="imageIndex">Index of the image.</param>
  83. /// <param name="internalCacheKey">The internal cache key.</param>
  84. /// <param name="cancellationToken">The cancellation token.</param>
  85. /// <returns>Task.</returns>
  86. Task SaveImage(IHasImages item, string source, string mimeType, ImageType type, int? imageIndex, string internalCacheKey, CancellationToken cancellationToken);
  87. /// <summary>
  88. /// Adds the metadata providers.
  89. /// </summary>
  90. /// <param name="imageProviders">The image providers.</param>
  91. /// <param name="metadataServices">The metadata services.</param>
  92. /// <param name="metadataProviders">The metadata providers.</param>
  93. /// <param name="savers">The savers.</param>
  94. /// <param name="imageSavers">The image savers.</param>
  95. /// <param name="externalIds">The external ids.</param>
  96. void AddParts(IEnumerable<IImageProvider> imageProviders, IEnumerable<IMetadataService> metadataServices, IEnumerable<IMetadataProvider> metadataProviders,
  97. IEnumerable<IMetadataSaver> savers,
  98. IEnumerable<IImageSaver> imageSavers,
  99. IEnumerable<IExternalId> externalIds);
  100. /// <summary>
  101. /// Gets the available remote images.
  102. /// </summary>
  103. /// <param name="item">The item.</param>
  104. /// <param name="query">The query.</param>
  105. /// <param name="cancellationToken">The cancellation token.</param>
  106. /// <returns>Task{IEnumerable{RemoteImageInfo}}.</returns>
  107. Task<IEnumerable<RemoteImageInfo>> GetAvailableRemoteImages(IHasImages item, RemoteImageQuery query, CancellationToken cancellationToken);
  108. /// <summary>
  109. /// Gets the image providers.
  110. /// </summary>
  111. /// <param name="item">The item.</param>
  112. /// <returns>IEnumerable{ImageProviderInfo}.</returns>
  113. IEnumerable<ImageProviderInfo> GetRemoteImageProviderInfo(IHasImages item);
  114. /// <summary>
  115. /// Gets all metadata plugins.
  116. /// </summary>
  117. /// <returns>IEnumerable{MetadataPlugin}.</returns>
  118. IEnumerable<MetadataPluginSummary> GetAllMetadataPlugins();
  119. /// <summary>
  120. /// Gets the external urls.
  121. /// </summary>
  122. /// <param name="item">The item.</param>
  123. /// <returns>IEnumerable{ExternalUrl}.</returns>
  124. IEnumerable<ExternalUrl> GetExternalUrls(BaseItem item);
  125. /// <summary>
  126. /// Gets the external identifier infos.
  127. /// </summary>
  128. /// <param name="item">The item.</param>
  129. /// <returns>IEnumerable{ExternalIdInfo}.</returns>
  130. IEnumerable<ExternalIdInfo> GetExternalIdInfos(IHasProviderIds item);
  131. /// <summary>
  132. /// Saves the metadata.
  133. /// </summary>
  134. /// <param name="item">The item.</param>
  135. /// <param name="updateType">Type of the update.</param>
  136. /// <returns>Task.</returns>
  137. Task SaveMetadata(IHasMetadata item, ItemUpdateType updateType);
  138. /// <summary>
  139. /// Saves the metadata.
  140. /// </summary>
  141. /// <param name="item">The item.</param>
  142. /// <param name="updateType">Type of the update.</param>
  143. /// <param name="savers">The savers.</param>
  144. /// <returns>Task.</returns>
  145. Task SaveMetadata(IHasMetadata item, ItemUpdateType updateType, IEnumerable<string> savers);
  146. /// <summary>
  147. /// Gets the metadata options.
  148. /// </summary>
  149. /// <param name="item">The item.</param>
  150. /// <returns>MetadataOptions.</returns>
  151. MetadataOptions GetMetadataOptions(IHasImages item);
  152. /// <summary>
  153. /// Gets the remote search results.
  154. /// </summary>
  155. /// <typeparam name="TItemType">The type of the t item type.</typeparam>
  156. /// <typeparam name="TLookupType">The type of the t lookup type.</typeparam>
  157. /// <param name="searchInfo">The search information.</param>
  158. /// <param name="cancellationToken">The cancellation token.</param>
  159. /// <returns>Task{IEnumerable{SearchResult{``1}}}.</returns>
  160. Task<IEnumerable<RemoteSearchResult>> GetRemoteSearchResults<TItemType, TLookupType>(
  161. RemoteSearchQuery<TLookupType> searchInfo,
  162. CancellationToken cancellationToken)
  163. where TItemType : BaseItem, new()
  164. where TLookupType : ItemLookupInfo;
  165. /// <summary>
  166. /// Gets the search image.
  167. /// </summary>
  168. /// <param name="providerName">Name of the provider.</param>
  169. /// <param name="url">The URL.</param>
  170. /// <param name="cancellationToken">The cancellation token.</param>
  171. /// <returns>Task{HttpResponseInfo}.</returns>
  172. Task<HttpResponseInfo> GetSearchImage(string providerName, string url, CancellationToken cancellationToken);
  173. }
  174. }