using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Tasks; namespace Emby.Server.Implementations.ScheduledTasks.Tasks { /// /// Class PeopleValidationTask. /// public class PeopleValidationTask : IScheduledTask, IConfigurableScheduledTask { private readonly ILibraryManager _libraryManager; private readonly ILocalizationManager _localization; /// /// Initializes a new instance of the class. /// /// Instance of the interface. /// Instance of the interface. public PeopleValidationTask(ILibraryManager libraryManager, ILocalizationManager localization) { _libraryManager = libraryManager; _localization = localization; } /// public string Name => _localization.GetLocalizedString("TaskRefreshPeople"); /// public string Description => _localization.GetLocalizedString("TaskRefreshPeopleDescription"); /// public string Category => _localization.GetLocalizedString("TasksLibraryCategory"); /// public string Key => "RefreshPeople"; /// public bool IsHidden => false; /// public bool IsEnabled => true; /// public bool IsLogged => true; /// /// Creates the triggers that define when the task will run. /// /// An containing the default trigger infos for this task. public IEnumerable GetDefaultTriggers() { return new[] { new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromDays(7).Ticks } }; } /// public Task ExecuteAsync(IProgress progress, CancellationToken cancellationToken) { return _libraryManager.ValidatePeopleAsync(progress, cancellationToken); } } }