IFileOrganizationService.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using MediaBrowser.Model.Events;
  2. using MediaBrowser.Model.FileOrganization;
  3. using MediaBrowser.Model.Querying;
  4. using System;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. namespace MediaBrowser.Controller.FileOrganization
  8. {
  9. public interface IFileOrganizationService
  10. {
  11. event EventHandler<GenericEventArgs<FileOrganizationResult>> ItemAdded;
  12. event EventHandler<GenericEventArgs<FileOrganizationResult>> ItemUpdated;
  13. event EventHandler<GenericEventArgs<FileOrganizationResult>> ItemRemoved;
  14. event EventHandler LogReset;
  15. /// <summary>
  16. /// Processes the new files.
  17. /// </summary>
  18. void BeginProcessNewFiles();
  19. /// <summary>
  20. /// Deletes the original file.
  21. /// </summary>
  22. /// <param name="resultId">The result identifier.</param>
  23. /// <returns>Task.</returns>
  24. Task DeleteOriginalFile(string resultId);
  25. /// <summary>
  26. /// Clears the log.
  27. /// </summary>
  28. /// <returns>Task.</returns>
  29. Task ClearLog();
  30. /// <summary>
  31. /// Performs the organization.
  32. /// </summary>
  33. /// <param name="resultId">The result identifier.</param>
  34. /// <returns>Task.</returns>
  35. Task PerformOrganization(string resultId);
  36. /// <summary>
  37. /// Performs the episode organization.
  38. /// </summary>
  39. /// <param name="request">The request.</param>
  40. /// <returns>Task.</returns>
  41. Task PerformEpisodeOrganization(EpisodeFileOrganizationRequest request);
  42. /// <summary>
  43. /// Gets the results.
  44. /// </summary>
  45. /// <param name="query">The query.</param>
  46. /// <returns>IEnumerable{FileOrganizationResult}.</returns>
  47. QueryResult<FileOrganizationResult> GetResults(FileOrganizationResultQuery query);
  48. /// <summary>
  49. /// Gets the result.
  50. /// </summary>
  51. /// <param name="id">The identifier.</param>
  52. /// <returns>FileOrganizationResult.</returns>
  53. FileOrganizationResult GetResult(string id);
  54. /// <summary>
  55. /// Gets the result by source path.
  56. /// </summary>
  57. /// <param name="path">The path.</param>
  58. /// <returns>FileOrganizationResult.</returns>
  59. FileOrganizationResult GetResultBySourcePath(string path);
  60. /// <summary>
  61. /// Saves the result.
  62. /// </summary>
  63. /// <param name="result">The result.</param>
  64. /// <param name="cancellationToken">The cancellation token.</param>
  65. /// <returns>Task.</returns>
  66. Task SaveResult(FileOrganizationResult result, CancellationToken cancellationToken);
  67. /// <summary>
  68. /// Returns a list of smart match entries
  69. /// </summary>
  70. /// <param name="query">The query.</param>
  71. /// <returns>IEnumerable{SmartMatchInfo}.</returns>
  72. QueryResult<SmartMatchInfo> GetSmartMatchInfos(FileOrganizationResultQuery query);
  73. /// <summary>
  74. /// Deletes a smart match entry.
  75. /// </summary>
  76. /// <param name="ItemName">Item name.</param>
  77. /// <param name="matchString">The match string to delete.</param>
  78. void DeleteSmartMatchEntry(string ItemName, string matchString);
  79. /// <summary>
  80. /// Attempts to add a an item to the list of currently processed items.
  81. /// </summary>
  82. /// <param name="result">The result item.</param>
  83. /// <param name="fullClientRefresh">Passing true will notify the client to reload all items, otherwise only a single item will be refreshed.</param>
  84. /// <returns>True if the item was added, False if the item is already contained in the list.</returns>
  85. bool AddToInProgressList(FileOrganizationResult result, bool fullClientRefresh);
  86. /// <summary>
  87. /// Removes an item from the list of currently processed items.
  88. /// </summary>
  89. /// <param name="result">The result item.</param>
  90. /// <returns>True if the item was removed, False if the item was not contained in the list.</returns>
  91. bool RemoveFromInprogressList(FileOrganizationResult result);
  92. }
  93. }