From 07072d9f7bf269926a4d7aad580e2e78c444a2cd Mon Sep 17 00:00:00 2001 From: dkanada Date: Thu, 31 Jan 2019 15:12:18 +0900 Subject: move all scheduled tasks and triggers into folders --- .../ScheduledTasks/Tasks/PeopleValidationTask.cs | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs (limited to 'Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs') diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs new file mode 100644 index 0000000000..68031170fd --- /dev/null +++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Controller; +using MediaBrowser.Controller.Library; +using MediaBrowser.Model.Tasks; + +namespace Emby.Server.Implementations.ScheduledTasks +{ + /// + /// Class PeopleValidationTask + /// + public class PeopleValidationTask : IScheduledTask + { + /// + /// The _library manager + /// + private readonly ILibraryManager _libraryManager; + + private readonly IServerApplicationHost _appHost; + + /// + /// Initializes a new instance of the class. + /// + /// The library manager. + /// The server application host + public PeopleValidationTask(ILibraryManager libraryManager, IServerApplicationHost appHost) + { + _libraryManager = libraryManager; + _appHost = appHost; + } + + /// + /// Creates the triggers that define when the task will run + /// + public IEnumerable GetDefaultTriggers() + { + return new[] + { + // Every so often + new TaskTriggerInfo + { + Type = TaskTriggerInfo.TriggerInterval, + IntervalTicks = TimeSpan.FromDays(7).Ticks + } + }; + } + + public string Key => "RefreshPeople"; + + /// + /// Returns the task to be executed + /// + /// The cancellation token. + /// The progress. + /// Task. + public Task Execute(CancellationToken cancellationToken, IProgress progress) + { + return _libraryManager.ValidatePeople(cancellationToken, progress); + } + + /// + /// Gets the name of the task + /// + /// The name. + public string Name => "Refresh people"; + + /// + /// Gets the description. + /// + /// The description. + public string Description => "Updates metadata for actors and directors in your media library."; + + /// + /// Gets the category. + /// + /// The category. + public string Category => "Library"; + } +} -- cgit v1.2.3