IProviderManager.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Controller.Library;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. namespace MediaBrowser.Controller.Providers
  8. {
  9. /// <summary>
  10. /// Interface IProviderManager
  11. /// </summary>
  12. public interface IProviderManager
  13. {
  14. /// <summary>
  15. /// Downloads the and save image.
  16. /// </summary>
  17. /// <param name="item">The item.</param>
  18. /// <param name="source">The source.</param>
  19. /// <param name="targetName">Name of the target.</param>
  20. /// <param name="saveLocally">if set to <c>true</c> [save locally].</param>
  21. /// <param name="resourcePool">The resource pool.</param>
  22. /// <param name="cancellationToken">The cancellation token.</param>
  23. /// <returns>Task{System.String}.</returns>
  24. /// <exception cref="System.ArgumentNullException">item</exception>
  25. Task<string> DownloadAndSaveImage(BaseItem item, string source, string targetName, bool saveLocally, SemaphoreSlim resourcePool, CancellationToken cancellationToken);
  26. /// <summary>
  27. /// Saves the image.
  28. /// </summary>
  29. /// <param name="item">The item.</param>
  30. /// <param name="source">The source.</param>
  31. /// <param name="targetName">Name of the target.</param>
  32. /// <param name="saveLocally">if set to <c>true</c> [save locally].</param>
  33. /// <param name="cancellationToken">The cancellation token.</param>
  34. /// <returns>Task{System.String}.</returns>
  35. Task<string> SaveImage(BaseItem item, Stream source, string targetName, bool saveLocally, CancellationToken cancellationToken);
  36. /// <summary>
  37. /// Saves to library filesystem.
  38. /// </summary>
  39. /// <param name="item">The item.</param>
  40. /// <param name="path">The path.</param>
  41. /// <param name="dataToSave">The data to save.</param>
  42. /// <param name="cancellationToken">The cancellation token.</param>
  43. /// <returns>Task.</returns>
  44. /// <exception cref="System.ArgumentNullException"></exception>
  45. Task SaveToLibraryFilesystem(BaseItem item, string path, Stream dataToSave, CancellationToken cancellationToken);
  46. /// <summary>
  47. /// Executes the metadata providers.
  48. /// </summary>
  49. /// <param name="item">The item.</param>
  50. /// <param name="cancellationToken">The cancellation token.</param>
  51. /// <param name="force">if set to <c>true</c> [force].</param>
  52. /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
  53. /// <returns>Task{System.Boolean}.</returns>
  54. Task<bool> ExecuteMetadataProviders(BaseItem item, CancellationToken cancellationToken, bool force = false, bool allowSlowProviders = true);
  55. /// <summary>
  56. /// Adds the metadata providers.
  57. /// </summary>
  58. /// <param name="providers">The providers.</param>
  59. /// <param name="savers">The savers.</param>
  60. void AddParts(IEnumerable<BaseMetadataProvider> providers,
  61. IEnumerable<IMetadataSaver> savers);
  62. /// <summary>
  63. /// Gets the save path.
  64. /// </summary>
  65. /// <param name="item">The item.</param>
  66. /// <param name="targetFileName">Name of the target file.</param>
  67. /// <param name="saveLocally">if set to <c>true</c> [save locally].</param>
  68. /// <returns>System.String.</returns>
  69. string GetSavePath(BaseItem item, string targetFileName, bool saveLocally);
  70. }
  71. }