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

76 lines
2.3 KiB
C#
Raw Normal View History

2013-02-21 01:33:05 +00: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;
2013-02-21 01:33:05 +00:00
namespace Emby.Server.Implementations.ScheduledTasks
2013-02-21 01:33:05 +00:00
{
/// <summary>
/// Class PeopleValidationTask
/// </summary>
public class PeopleValidationTask : IScheduledTask
2013-02-21 01:33:05 +00:00
{
/// <summary>
/// The _library manager
/// </summary>
private readonly ILibraryManager _libraryManager;
private readonly IServerApplicationHost _appHost;
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="appHost">The server application host</param>
public PeopleValidationTask(ILibraryManager libraryManager, IServerApplicationHost appHost)
2013-02-23 07:57:11 +00:00
{
_libraryManager = libraryManager;
_appHost = appHost;
2013-02-23 07:57:11 +00:00
}
2013-02-21 01:33:05 +00:00
/// <summary>
/// Creates the triggers that define when the task will run
/// </summary>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
2013-02-21 01:33:05 +00:00
{
2019-01-07 23:27:46 +00:00
return new[]
{
// Every so often
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>
/// Returns the task to be executed
/// </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
}
public string Name => "Refresh people";
2013-02-21 01:33:05 +00:00
public string Description => "Updates metadata for actors and directors in your media library.";
2013-02-21 01:33:05 +00:00
public string Category => "Library";
public string Key => "RefreshPeople";
public bool IsHidden => false;
public bool IsEnabled => true;
public bool IsLogged => true;
2013-02-21 01:33:05 +00:00
}
}