Files
jellyfin-jellyfin-1/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs

70 lines
2.3 KiB
C#
Raw Normal View History

2013-02-20 20:33:05 -05: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 11:37:55 +01:00
using MediaBrowser.Model.Tasks;
2013-02-20 20:33:05 -05:00
2025-04-30 09:29:13 +02:00
namespace Emby.Server.Implementations.ScheduledTasks.Tasks;
/// <summary>
/// Class PeopleValidationTask.
/// </summary>
public class PeopleValidationTask : IScheduledTask, IConfigurableScheduledTask
2013-02-20 20:33:05 -05:00
{
2025-04-30 09:29:13 +02:00
private readonly ILibraryManager _libraryManager;
private readonly ILocalizationManager _localization;
2013-02-20 20:33:05 -05:00
/// <summary>
2025-04-30 09:29:13 +02:00
/// Initializes a new instance of the <see cref="PeopleValidationTask" /> class.
2013-02-20 20:33:05 -05:00
/// </summary>
2025-04-30 09:29:13 +02:00
/// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
/// <param name="localization">Instance of the <see cref="ILocalizationManager"/> interface.</param>
public PeopleValidationTask(ILibraryManager libraryManager, ILocalizationManager localization)
2013-02-20 20:33:05 -05:00
{
2025-04-30 09:29:13 +02:00
_libraryManager = libraryManager;
_localization = localization;
}
2013-02-23 02:57:11 -05:00
2025-04-30 09:29:13 +02:00
/// <inheritdoc />
public string Name => _localization.GetLocalizedString("TaskRefreshPeople");
2021-10-02 12:53:51 -04:00
2025-04-30 09:29:13 +02:00
/// <inheritdoc />
public string Description => _localization.GetLocalizedString("TaskRefreshPeopleDescription");
2021-10-02 12:53:51 -04:00
2025-04-30 09:29:13 +02:00
/// <inheritdoc />
public string Category => _localization.GetLocalizedString("TasksLibraryCategory");
2021-10-02 12:53:51 -04:00
2025-04-30 09:29:13 +02:00
/// <inheritdoc />
public string Key => "RefreshPeople";
2021-10-02 12:53:51 -04:00
2025-04-30 09:29:13 +02:00
/// <inheritdoc />
public bool IsHidden => false;
2021-10-02 12:53:51 -04:00
2025-04-30 09:29:13 +02:00
/// <inheritdoc />
public bool IsEnabled => true;
2021-10-02 12:53:51 -04:00
2025-04-30 09:29:13 +02:00
/// <inheritdoc />
public bool IsLogged => true;
2021-10-02 12:53:51 -04:00
2025-04-30 09:29:13 +02:00
/// <summary>
/// Creates the triggers that define when the task will run.
/// </summary>
/// <returns>An <see cref="IEnumerable{TaskTriggerInfo}"/> containing the default trigger infos for this task.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
yield return new TaskTriggerInfo
2013-02-20 20:33:05 -05:00
{
2025-04-30 09:29:13 +02:00
Type = TaskTriggerInfoType.IntervalTrigger,
IntervalTicks = TimeSpan.FromDays(7).Ticks
};
}
2025-04-30 09:29:13 +02:00
/// <inheritdoc />
public Task ExecuteAsync(IProgress<double> progress, CancellationToken cancellationToken)
{
return _libraryManager.ValidatePeopleAsync(progress, cancellationToken);
2013-02-20 20:33:05 -05:00
}
}