using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Library;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.ScheduledTasks
{
///
/// Class PeopleValidationTask
///
public class PeopleValidationTask : IScheduledTask
{
///
/// The _library manager
///
private readonly ILibraryManager _libraryManager;
///
/// Initializes a new instance of the class.
///
/// The library manager.
public PeopleValidationTask(ILibraryManager libraryManager)
{
_libraryManager = libraryManager;
}
///
/// Creates the triggers that define when the task will run
///
/// IEnumerable{BaseTaskTrigger}.
public IEnumerable GetDefaultTriggers()
{
return new ITaskTrigger[]
{
new DailyTrigger { TimeOfDay = TimeSpan.FromHours(2) },
new IntervalTrigger{ Interval = TimeSpan.FromHours(12)}
};
}
///
/// Returns the task to be executed
///
/// The cancellation token.
/// The progress.
/// Task.
public Task Execute(CancellationToken cancellationToken, IProgress progress)
{
return _libraryManager.ValidatePeople(cancellationToken, progress);
}
///
/// Gets the name of the task
///
/// The name.
public string Name
{
get { return "Refresh people"; }
}
///
/// Gets the description.
///
/// The description.
public string Description
{
get { return "Updates metadata for actors, artists and directors in your media library."; }
}
///
/// Gets the category.
///
/// The category.
public string Category
{
get
{
return "Library";
}
}
}
}