PeopleValidationTask.cs 2.1 KB

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