aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2019-02-03 22:34:40 -0500
committerGitHub <noreply@github.com>2019-02-03 22:34:40 -0500
commit20033f2275361ed4d46df77da0694f8f7dc3f04f (patch)
tree958ec85809d478ad3088d101365f1695e6ba617f /Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
parentbe89d53a9e16e16f434c35e22814f1d9fe3fc16d (diff)
parentc4c0894b29898ab6826542abc7a247291b46f804 (diff)
Merge branch 'master' into fix-env
Diffstat (limited to 'Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs')
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs75
1 files changed, 75 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
new file mode 100644
index 000000000..d70799c47
--- /dev/null
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using MediaBrowser.Controller;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Model.Tasks;
+
+namespace Emby.Server.Implementations.ScheduledTasks
+{
+ /// <summary>
+ /// Class PeopleValidationTask
+ /// </summary>
+ public class PeopleValidationTask : IScheduledTask
+ {
+ /// <summary>
+ /// The _library manager
+ /// </summary>
+ private readonly ILibraryManager _libraryManager;
+
+ private readonly IServerApplicationHost _appHost;
+
+ /// <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)
+ {
+ _libraryManager = libraryManager;
+ _appHost = appHost;
+ }
+
+ /// <summary>
+ /// Creates the triggers that define when the task will run
+ /// </summary>
+ public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
+ {
+ return new[]
+ {
+ // Every so often
+ new TaskTriggerInfo
+ {
+ Type = TaskTriggerInfo.TriggerInterval,
+ IntervalTicks = TimeSpan.FromDays(7).Ticks
+ }
+ };
+ }
+
+ /// <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)
+ {
+ return _libraryManager.ValidatePeople(cancellationToken, progress);
+ }
+
+ public string Name => "Refresh people";
+
+ public string Description => "Updates metadata for actors and directors in your media library.";
+
+ public string Category => "Library";
+
+ public string Key => "RefreshPeople";
+
+ public bool IsHidden => false;
+
+ public bool IsEnabled => true;
+
+ public bool IsLogged => true;
+ }
+}