IProviderManager.cs 2.9 KB

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