jellyfin/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs

77 lines
2.5 KiB
C#
Raw Normal View History

#pragma warning disable CS1591
2013-02-21 01:33:05 +00:00
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Globalization;
2021-04-17 10:37:55 +00:00
using MediaBrowser.Model.Tasks;
2013-02-21 01:33:05 +00:00
namespace Emby.Server.Implementations.ScheduledTasks
2013-02-21 01:33:05 +00:00
{
/// <summary>
2020-02-01 13:27:25 +00:00
/// Class PeopleValidationTask.
2013-02-21 01:33:05 +00:00
/// </summary>
public class PeopleValidationTask : IScheduledTask
2013-02-21 01:33:05 +00:00
{
/// <summary>
2020-02-01 13:27:25 +00:00
/// The library manager.
/// </summary>
private readonly ILibraryManager _libraryManager;
private readonly ILocalizationManager _localization;
2013-02-23 07:57:11 +00:00
/// <summary>
/// Initializes a new instance of the <see cref="PeopleValidationTask" /> class.
/// </summary>
/// <param name="libraryManager">The library manager.</param>
/// <param name="localization">The localization manager.</param>
public PeopleValidationTask(ILibraryManager libraryManager, ILocalizationManager localization)
2013-02-23 07:57:11 +00:00
{
_libraryManager = libraryManager;
2020-03-26 21:26:25 +00:00
_localization = localization;
2013-02-23 07:57:11 +00:00
}
2021-10-02 16:53:51 +00:00
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;
2013-02-21 01:33:05 +00:00
/// <summary>
2020-02-01 13:27:25 +00:00
/// Creates the triggers that define when the task will run.
2013-02-21 01:33:05 +00:00
/// </summary>
2021-10-02 16:53:51 +00:00
/// <returns>An <see cref="IEnumerable{TaskTriggerInfo}"/> containing the default trigger infos for this task.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
2013-02-21 01:33:05 +00:00
{
2019-01-07 23:27:46 +00:00
return new[]
{
2016-12-03 20:00:41 +00:00
new TaskTriggerInfo
{
Type = TaskTriggerInfo.TriggerInterval,
IntervalTicks = TimeSpan.FromDays(7).Ticks
}
};
}
2013-02-21 01:33:05 +00:00
/// <summary>
2020-02-01 13:27:25 +00:00
/// Returns the task to be executed.
2013-02-21 01:33:05 +00:00
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <returns>Task.</returns>
public Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
2013-02-21 01:33:05 +00:00
{
return _libraryManager.ValidatePeople(cancellationToken, progress);
2013-02-21 01:33:05 +00:00
}
}
}