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

77 lines
2.5 KiB
C#
Raw Normal View History

2013-02-21 02:33:05 +01:00
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Globalization;
2013-02-21 02:33:05 +01:00
namespace Emby.Server.Implementations.ScheduledTasks
2013-02-21 02:33:05 +01:00
{
/// <summary>
2020-02-01 14:27:25 +01:00
/// Class PeopleValidationTask.
2013-02-21 02:33:05 +01:00
/// </summary>
public class PeopleValidationTask : IScheduledTask
2013-02-21 02:33:05 +01:00
{
/// <summary>
2020-02-01 14:27:25 +01:00
/// The library manager.
/// </summary>
private readonly ILibraryManager _libraryManager;
private readonly IServerApplicationHost _appHost;
private readonly ILocalizationManager _localization;
2013-02-23 08:57:11 +01:00
/// <summary>
/// Initializes a new instance of the <see cref="PeopleValidationTask" /> class.
/// </summary>
/// <param name="libraryManager">The library manager.</param>
/// <param name="appHost">The server application host</param>
public PeopleValidationTask(ILibraryManager libraryManager, IServerApplicationHost appHost)
2013-02-23 08:57:11 +01:00
{
_libraryManager = libraryManager;
_appHost = appHost;
2013-02-23 08:57:11 +01:00
}
2013-02-21 02:33:05 +01:00
/// <summary>
2020-02-01 14:27:25 +01:00
/// Creates the triggers that define when the task will run.
2013-02-21 02:33:05 +01:00
/// </summary>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
2013-02-21 02:33:05 +01:00
{
2019-01-08 00:27:46 +01:00
return new[]
{
2016-12-03 21:00:41 +01:00
new TaskTriggerInfo
{
Type = TaskTriggerInfo.TriggerInterval,
IntervalTicks = TimeSpan.FromDays(7).Ticks
}
};
}
2013-02-21 02:33:05 +01:00
/// <summary>
2020-02-01 14:27:25 +01:00
/// Returns the task to be executed.
2013-02-21 02:33:05 +01: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 02:33:05 +01:00
{
return _libraryManager.ValidatePeople(cancellationToken, progress);
2013-02-21 02:33:05 +01:00
}
public string Name => _localization.GetLocalizedString("TaskRefreshPeople");
2013-02-21 02:33:05 +01:00
public string Description => _localization.GetLocalizedString("TaskRefreshPeopleDescription");
2013-02-21 02:33:05 +01:00
2020-03-26 21:40:41 +01:00
public string Category => _localization.GetLocalizedString("TasksCategoryLibrary");
public string Key => "RefreshPeople";
public bool IsHidden => false;
public bool IsEnabled => true;
public bool IsLogged => true;
2013-02-21 02:33:05 +01:00
}
}