2020-05-29 11:28:19 +02:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
|
2013-02-20 20:33:05 -05:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-01-13 20:22:24 +01:00
|
|
|
using MediaBrowser.Controller.Library;
|
2020-03-26 20:28:30 +01:00
|
|
|
using MediaBrowser.Model.Globalization;
|
2021-04-17 11:37:55 +01:00
|
|
|
using MediaBrowser.Model.Tasks;
|
2013-02-20 20:33:05 -05:00
|
|
|
|
2016-11-02 16:58:51 -04:00
|
|
|
namespace Emby.Server.Implementations.ScheduledTasks
|
2013-02-20 20:33:05 -05:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2020-02-01 22:27:25 +09:00
|
|
|
/// Class PeopleValidationTask.
|
2013-02-20 20:33:05 -05:00
|
|
|
/// </summary>
|
2013-02-25 22:43:04 -05:00
|
|
|
public class PeopleValidationTask : IScheduledTask
|
2013-02-20 20:33:05 -05:00
|
|
|
{
|
2013-02-28 14:32:41 -05:00
|
|
|
/// <summary>
|
2020-02-01 22:27:25 +09:00
|
|
|
/// The library manager.
|
2013-02-28 14:32:41 -05:00
|
|
|
/// </summary>
|
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
2020-03-26 20:28:30 +01:00
|
|
|
private readonly ILocalizationManager _localization;
|
2015-12-12 21:31:37 -05:00
|
|
|
|
2013-02-23 02:57:11 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="PeopleValidationTask" /> class.
|
|
|
|
|
/// </summary>
|
2013-02-28 14:32:41 -05:00
|
|
|
/// <param name="libraryManager">The library manager.</param>
|
2020-05-29 11:28:19 +02:00
|
|
|
/// <param name="localization">The localization manager.</param>
|
|
|
|
|
public PeopleValidationTask(ILibraryManager libraryManager, ILocalizationManager localization)
|
2013-02-23 02:57:11 -05:00
|
|
|
{
|
2013-02-28 14:32:41 -05:00
|
|
|
_libraryManager = libraryManager;
|
2020-03-26 22:26:25 +01:00
|
|
|
_localization = localization;
|
2013-02-23 02:57:11 -05:00
|
|
|
}
|
|
|
|
|
|
2013-02-20 20:33:05 -05:00
|
|
|
/// <summary>
|
2020-02-01 22:27:25 +09:00
|
|
|
/// Creates the triggers that define when the task will run.
|
2013-02-20 20:33:05 -05:00
|
|
|
/// </summary>
|
2016-10-23 15:14:57 -04:00
|
|
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
2013-02-20 20:33:05 -05:00
|
|
|
{
|
2019-01-07 23:27:46 +00:00
|
|
|
return new[]
|
|
|
|
|
{
|
2016-12-03 15:00:41 -05:00
|
|
|
new TaskTriggerInfo
|
|
|
|
|
{
|
|
|
|
|
Type = TaskTriggerInfo.TriggerInterval,
|
|
|
|
|
IntervalTicks = TimeSpan.FromDays(7).Ticks
|
|
|
|
|
}
|
2016-10-23 15:14:57 -04:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-20 20:33:05 -05:00
|
|
|
/// <summary>
|
2020-02-01 22:27:25 +09:00
|
|
|
/// Returns the task to be executed.
|
2013-02-20 20:33:05 -05:00
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <param name="progress">The progress.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2013-02-25 22:43:04 -05:00
|
|
|
public Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
|
2013-02-20 20:33:05 -05:00
|
|
|
{
|
2013-02-28 14:32:41 -05:00
|
|
|
return _libraryManager.ValidatePeople(cancellationToken, progress);
|
2013-02-20 20:33:05 -05:00
|
|
|
}
|
|
|
|
|
|
2020-03-26 20:28:30 +01:00
|
|
|
public string Name => _localization.GetLocalizedString("TaskRefreshPeople");
|
2013-02-20 20:33:05 -05:00
|
|
|
|
2020-03-26 20:28:30 +01:00
|
|
|
public string Description => _localization.GetLocalizedString("TaskRefreshPeopleDescription");
|
2013-02-20 20:33:05 -05:00
|
|
|
|
2020-03-29 23:46:19 +02:00
|
|
|
public string Category => _localization.GetLocalizedString("TasksLibraryCategory");
|
2019-01-31 15:20:34 +09:00
|
|
|
|
|
|
|
|
public string Key => "RefreshPeople";
|
|
|
|
|
|
|
|
|
|
public bool IsHidden => false;
|
|
|
|
|
|
|
|
|
|
public bool IsEnabled => true;
|
|
|
|
|
|
|
|
|
|
public bool IsLogged => true;
|
2013-02-20 20:33:05 -05:00
|
|
|
}
|
|
|
|
|
}
|