You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.6 KiB
82 lines
2.6 KiB
12 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Threading;
|
||
|
using System.Threading.Tasks;
|
||
9 years ago
|
using MediaBrowser.Controller;
|
||
6 years ago
|
using MediaBrowser.Controller.Library;
|
||
8 years ago
|
using MediaBrowser.Model.Tasks;
|
||
12 years ago
|
|
||
8 years ago
|
namespace Emby.Server.Implementations.ScheduledTasks
|
||
12 years ago
|
{
|
||
|
/// <summary>
|
||
|
/// Class PeopleValidationTask
|
||
|
/// </summary>
|
||
12 years ago
|
public class PeopleValidationTask : IScheduledTask
|
||
12 years ago
|
{
|
||
12 years ago
|
/// <summary>
|
||
|
/// The _library manager
|
||
|
/// </summary>
|
||
|
private readonly ILibraryManager _libraryManager;
|
||
12 years ago
|
|
||
9 years ago
|
private readonly IServerApplicationHost _appHost;
|
||
|
|
||
12 years ago
|
/// <summary>
|
||
|
/// Initializes a new instance of the <see cref="PeopleValidationTask" /> class.
|
||
|
/// </summary>
|
||
12 years ago
|
/// <param name="libraryManager">The library manager.</param>
|
||
6 years ago
|
/// <param name="appHost">The server application host</param>
|
||
9 years ago
|
public PeopleValidationTask(ILibraryManager libraryManager, IServerApplicationHost appHost)
|
||
12 years ago
|
{
|
||
12 years ago
|
_libraryManager = libraryManager;
|
||
9 years ago
|
_appHost = appHost;
|
||
12 years ago
|
}
|
||
|
|
||
12 years ago
|
/// <summary>
|
||
|
/// Creates the triggers that define when the task will run
|
||
|
/// </summary>
|
||
8 years ago
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||
12 years ago
|
{
|
||
6 years ago
|
return new[]
|
||
|
{
|
||
8 years ago
|
// Every so often
|
||
8 years ago
|
new TaskTriggerInfo
|
||
|
{
|
||
|
Type = TaskTriggerInfo.TriggerInterval,
|
||
|
IntervalTicks = TimeSpan.FromDays(7).Ticks
|
||
|
}
|
||
8 years ago
|
};
|
||
|
}
|
||
|
|
||
6 years ago
|
public string Key => "RefreshPeople";
|
||
12 years ago
|
|
||
|
/// <summary>
|
||
|
/// Returns the task to be executed
|
||
|
/// </summary>
|
||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||
|
/// <param name="progress">The progress.</param>
|
||
|
/// <returns>Task.</returns>
|
||
12 years ago
|
public Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
|
||
12 years ago
|
{
|
||
12 years ago
|
return _libraryManager.ValidatePeople(cancellationToken, progress);
|
||
12 years ago
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Gets the name of the task
|
||
|
/// </summary>
|
||
|
/// <value>The name.</value>
|
||
6 years ago
|
public string Name => "Refresh people";
|
||
12 years ago
|
|
||
|
/// <summary>
|
||
|
/// Gets the description.
|
||
|
/// </summary>
|
||
|
/// <value>The description.</value>
|
||
6 years ago
|
public string Description => "Updates metadata for actors and directors in your media library.";
|
||
12 years ago
|
|
||
|
/// <summary>
|
||
|
/// Gets the category.
|
||
|
/// </summary>
|
||
|
/// <value>The category.</value>
|
||
6 years ago
|
public string Category => "Library";
|
||
12 years ago
|
}
|
||
|
}
|