PeopleValidationTask.cs 2.2 KB

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