aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
diff options
context:
space:
mode:
authorVasily <JustAMan@users.noreply.github.com>2019-02-03 16:42:29 +0300
committerGitHub <noreply@github.com>2019-02-03 16:42:29 +0300
commita50fb922c5f993c96fb0e716f11d6286ad9811da (patch)
treee6076d2c37b3e9930076859ef99448eff6d6ea95 /Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
parent32f393d57fd634ed9771078b5fbf87d4466a927c (diff)
parentc118f111b6eb4d0f665886f294114071ebe051a6 (diff)
Merge pull request #774 from dkanada/plugin
reimplement support for plugin repository
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;
+ }
+}