2
0

PeopleValidationTask.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using MediaBrowser.Common.ScheduledTasks;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Controller.ScheduledTasks
  7. {
  8. /// <summary>
  9. /// Class PeopleValidationTask
  10. /// </summary>
  11. public class PeopleValidationTask : IScheduledTask
  12. {
  13. private readonly Kernel _kernel;
  14. /// <summary>
  15. /// Initializes a new instance of the <see cref="PeopleValidationTask" /> class.
  16. /// </summary>
  17. /// <param name="kernel">The kernel.</param>
  18. public PeopleValidationTask(Kernel kernel)
  19. {
  20. _kernel = kernel;
  21. }
  22. /// <summary>
  23. /// Creates the triggers that define when the task will run
  24. /// </summary>
  25. /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
  26. public IEnumerable<ITaskTrigger> GetDefaultTriggers()
  27. {
  28. return new ITaskTrigger[]
  29. {
  30. new DailyTrigger { TimeOfDay = TimeSpan.FromHours(2) },
  31. new IntervalTrigger{ Interval = TimeSpan.FromHours(12)}
  32. };
  33. }
  34. /// <summary>
  35. /// Returns the task to be executed
  36. /// </summary>
  37. /// <param name="cancellationToken">The cancellation token.</param>
  38. /// <param name="progress">The progress.</param>
  39. /// <returns>Task.</returns>
  40. public Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
  41. {
  42. return _kernel.LibraryManager.ValidatePeople(cancellationToken, progress);
  43. }
  44. /// <summary>
  45. /// Gets the name of the task
  46. /// </summary>
  47. /// <value>The name.</value>
  48. public string Name
  49. {
  50. get { return "Refresh people"; }
  51. }
  52. /// <summary>
  53. /// Gets the description.
  54. /// </summary>
  55. /// <value>The description.</value>
  56. public string Description
  57. {
  58. get { return "Updates metadata for actors, artists and directors in your media library."; }
  59. }
  60. /// <summary>
  61. /// Gets the category.
  62. /// </summary>
  63. /// <value>The category.</value>
  64. public string Category
  65. {
  66. get
  67. {
  68. return "Library";
  69. }
  70. }
  71. }
  72. }