diff options
Diffstat (limited to 'MediaBrowser.Model/Tasks')
| -rw-r--r-- | MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs | 18 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/IScheduledTask.cs | 47 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/IScheduledTaskWorker.cs | 76 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/ITaskManager.cs | 80 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/ITaskTrigger.cs | 35 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs | 44 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/SystemEvent.cs | 14 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/TaskCompletionEventArgs.cs | 11 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/TaskCompletionStatus.cs | 29 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/TaskExecutionOptions.cs | 11 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/TaskInfo.cs | 78 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/TaskResult.cs | 58 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/TaskState.cs | 22 | ||||
| -rw-r--r-- | MediaBrowser.Model/Tasks/TaskTriggerInfo.cs | 52 |
14 files changed, 0 insertions, 575 deletions
diff --git a/MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs b/MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs deleted file mode 100644 index ed981a905..000000000 --- a/MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace MediaBrowser.Model.Tasks -{ - public interface IConfigurableScheduledTask - { - /// <summary> - /// Gets a value indicating whether this instance is hidden. - /// </summary> - /// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value> - bool IsHidden { get; } - /// <summary> - /// Gets a value indicating whether this instance is enabled. - /// </summary> - /// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value> - bool IsEnabled { get; } - - bool IsLogged { get; } - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/Tasks/IScheduledTask.cs b/MediaBrowser.Model/Tasks/IScheduledTask.cs deleted file mode 100644 index 81ba239ad..000000000 --- a/MediaBrowser.Model/Tasks/IScheduledTask.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Interface IScheduledTaskWorker - /// </summary> - public interface IScheduledTask - { - /// <summary> - /// Gets the name of the task - /// </summary> - /// <value>The name.</value> - string Name { get; } - - string Key { get; } - - /// <summary> - /// Gets the description. - /// </summary> - /// <value>The description.</value> - string Description { get; } - - /// <summary> - /// Gets the category. - /// </summary> - /// <value>The category.</value> - string Category { get; } - - /// <summary> - /// Executes the task - /// </summary> - /// <param name="cancellationToken">The cancellation token.</param> - /// <param name="progress">The progress.</param> - /// <returns>Task.</returns> - Task Execute(CancellationToken cancellationToken, IProgress<double> progress); - - /// <summary> - /// Gets the default triggers. - /// </summary> - /// <returns>IEnumerable{BaseTaskTrigger}.</returns> - IEnumerable<TaskTriggerInfo> GetDefaultTriggers(); - } -} diff --git a/MediaBrowser.Model/Tasks/IScheduledTaskWorker.cs b/MediaBrowser.Model/Tasks/IScheduledTaskWorker.cs deleted file mode 100644 index 415207f8f..000000000 --- a/MediaBrowser.Model/Tasks/IScheduledTaskWorker.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using MediaBrowser.Model.Events; - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Interface IScheduledTaskWorker - /// </summary> - public interface IScheduledTaskWorker : IDisposable - { - /// <summary> - /// Occurs when [task progress]. - /// </summary> - event EventHandler<GenericEventArgs<double>> TaskProgress; - - /// <summary> - /// Gets or sets the scheduled task. - /// </summary> - /// <value>The scheduled task.</value> - IScheduledTask ScheduledTask { get; } - - /// <summary> - /// Gets the last execution result. - /// </summary> - /// <value>The last execution result.</value> - TaskResult LastExecutionResult { get; } - - /// <summary> - /// Gets the name. - /// </summary> - /// <value>The name.</value> - string Name { get; } - - /// <summary> - /// Gets the description. - /// </summary> - /// <value>The description.</value> - string Description { get; } - - /// <summary> - /// Gets the category. - /// </summary> - /// <value>The category.</value> - string Category { get; } - - /// <summary> - /// Gets the state. - /// </summary> - /// <value>The state.</value> - TaskState State { get; } - - /// <summary> - /// Gets the current progress. - /// </summary> - /// <value>The current progress.</value> - double? CurrentProgress { get; } - - /// <summary> - /// Gets the triggers that define when the task will run - /// </summary> - /// <value>The triggers.</value> - /// <exception cref="ArgumentNullException">value</exception> - TaskTriggerInfo[] Triggers { get; set; } - - /// <summary> - /// Gets the unique id. - /// </summary> - /// <value>The unique id.</value> - string Id { get; } - - /// <summary> - /// Reloads the trigger events. - /// </summary> - void ReloadTriggerEvents(); - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/Tasks/ITaskManager.cs b/MediaBrowser.Model/Tasks/ITaskManager.cs deleted file mode 100644 index 1674fc107..000000000 --- a/MediaBrowser.Model/Tasks/ITaskManager.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using MediaBrowser.Model.Events; - -namespace MediaBrowser.Model.Tasks -{ - public interface ITaskManager : IDisposable - { - /// <summary> - /// Gets the list of Scheduled Tasks - /// </summary> - /// <value>The scheduled tasks.</value> - IScheduledTaskWorker[] ScheduledTasks { get; } - - /// <summary> - /// Cancels if running and queue. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="options">Task options.</param> - void CancelIfRunningAndQueue<T>(TaskExecutionOptions options) - where T : IScheduledTask; - - /// <summary> - /// Cancels if running and queue. - /// </summary> - /// <typeparam name="T"></typeparam> - void CancelIfRunningAndQueue<T>() - where T : IScheduledTask; - - /// <summary> - /// Cancels if running. - /// </summary> - /// <typeparam name="T"></typeparam> - void CancelIfRunning<T>() - where T : IScheduledTask; - - /// <summary> - /// Queues the scheduled task. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="options">Task options.</param> - void QueueScheduledTask<T>(TaskExecutionOptions options) - where T : IScheduledTask; - - /// <summary> - /// Queues the scheduled task. - /// </summary> - /// <typeparam name="T"></typeparam> - void QueueScheduledTask<T>() - where T : IScheduledTask; - - void QueueIfNotRunning<T>() - where T : IScheduledTask; - - /// <summary> - /// Queues the scheduled task. - /// </summary> - /// <param name="task">The task.</param> - /// <param name="options">The task run options.</param> - void QueueScheduledTask(IScheduledTask task, TaskExecutionOptions options = null); - - /// <summary> - /// Adds the tasks. - /// </summary> - /// <param name="tasks">The tasks.</param> - void AddTasks(IEnumerable<IScheduledTask> tasks); - - void Cancel(IScheduledTaskWorker task); - Task Execute(IScheduledTaskWorker task, TaskExecutionOptions options = null); - - void Execute<T>() - where T : IScheduledTask; - - event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting; - event EventHandler<TaskCompletionEventArgs> TaskCompleted; - - void RunTaskOnNextStartup(string key); - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/Tasks/ITaskTrigger.cs b/MediaBrowser.Model/Tasks/ITaskTrigger.cs deleted file mode 100644 index 3beca569c..000000000 --- a/MediaBrowser.Model/Tasks/ITaskTrigger.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Logging; - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Interface ITaskTrigger - /// </summary> - public interface ITaskTrigger - { - /// <summary> - /// Fires when the trigger condition is satisfied and the task should run - /// </summary> - event EventHandler<GenericEventArgs<TaskExecutionOptions>> Triggered; - - /// <summary> - /// Stars waiting for the trigger action - /// </summary> - void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup); - - /// <summary> - /// Stops waiting for the trigger action - /// </summary> - void Stop(); - - /// <summary> - /// Gets or sets the execution properties of this task. - /// </summary> - /// <value> - /// The execution properties of this task. - /// </value> - TaskExecutionOptions TaskOptions { get; set; } - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs b/MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs deleted file mode 100644 index 2dec79e93..000000000 --- a/MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs +++ /dev/null @@ -1,44 +0,0 @@ - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Class ScheduledTaskHelpers - /// </summary> - public static class ScheduledTaskHelpers - { - /// <summary> - /// Gets the task info. - /// </summary> - /// <param name="task">The task.</param> - /// <returns>TaskInfo.</returns> - public static TaskInfo GetTaskInfo(IScheduledTaskWorker task) - { - var isHidden = false; - - var configurableTask = task.ScheduledTask as IConfigurableScheduledTask; - - if (configurableTask != null) - { - isHidden = configurableTask.IsHidden; - } - - string key = task.ScheduledTask.Key; - - return new TaskInfo - { - Name = task.Name, - CurrentProgressPercentage = task.CurrentProgress, - State = task.State, - Id = task.Id, - LastExecutionResult = task.LastExecutionResult, - - Triggers = task.Triggers, - - Description = task.Description, - Category = task.Category, - IsHidden = isHidden, - Key = key - }; - } - } -} diff --git a/MediaBrowser.Model/Tasks/SystemEvent.cs b/MediaBrowser.Model/Tasks/SystemEvent.cs deleted file mode 100644 index 4d49a38cc..000000000 --- a/MediaBrowser.Model/Tasks/SystemEvent.cs +++ /dev/null @@ -1,14 +0,0 @@ - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Enum SystemEvent - /// </summary> - public enum SystemEvent - { - /// <summary> - /// The wake from sleep - /// </summary> - WakeFromSleep = 0 - } -} diff --git a/MediaBrowser.Model/Tasks/TaskCompletionEventArgs.cs b/MediaBrowser.Model/Tasks/TaskCompletionEventArgs.cs deleted file mode 100644 index be9eaa613..000000000 --- a/MediaBrowser.Model/Tasks/TaskCompletionEventArgs.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace MediaBrowser.Model.Tasks -{ - public class TaskCompletionEventArgs : EventArgs - { - public IScheduledTaskWorker Task { get; set; } - - public TaskResult Result { get; set; } - } -} diff --git a/MediaBrowser.Model/Tasks/TaskCompletionStatus.cs b/MediaBrowser.Model/Tasks/TaskCompletionStatus.cs deleted file mode 100644 index 6ba5ba5e4..000000000 --- a/MediaBrowser.Model/Tasks/TaskCompletionStatus.cs +++ /dev/null @@ -1,29 +0,0 @@ - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Enum TaskCompletionStatus - /// </summary> - public enum TaskCompletionStatus - { - /// <summary> - /// The completed - /// </summary> - Completed, - - /// <summary> - /// The failed - /// </summary> - Failed, - - /// <summary> - /// Manually cancelled by the user - /// </summary> - Cancelled, - - /// <summary> - /// Aborted due to a system failure or shutdown - /// </summary> - Aborted - } -} diff --git a/MediaBrowser.Model/Tasks/TaskExecutionOptions.cs b/MediaBrowser.Model/Tasks/TaskExecutionOptions.cs deleted file mode 100644 index faba35b22..000000000 --- a/MediaBrowser.Model/Tasks/TaskExecutionOptions.cs +++ /dev/null @@ -1,11 +0,0 @@ - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// A class that encomposases all common task run properties. - /// </summary> - public class TaskExecutionOptions - { - public int? MaxRuntimeMs { get; set; } - } -} diff --git a/MediaBrowser.Model/Tasks/TaskInfo.cs b/MediaBrowser.Model/Tasks/TaskInfo.cs deleted file mode 100644 index 8792ce952..000000000 --- a/MediaBrowser.Model/Tasks/TaskInfo.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System.Collections.Generic; - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Class TaskInfo - /// </summary> - public class TaskInfo - { - /// <summary> - /// Gets or sets the name. - /// </summary> - /// <value>The name.</value> - public string Name { get; set; } - - /// <summary> - /// Gets or sets the state of the task. - /// </summary> - /// <value>The state of the task.</value> - public TaskState State { get; set; } - - /// <summary> - /// Gets or sets the progress. - /// </summary> - /// <value>The progress.</value> - public double? CurrentProgressPercentage { get; set; } - - /// <summary> - /// Gets or sets the id. - /// </summary> - /// <value>The id.</value> - public string Id { get; set; } - - /// <summary> - /// Gets or sets the last execution result. - /// </summary> - /// <value>The last execution result.</value> - public TaskResult LastExecutionResult { get; set; } - - /// <summary> - /// Gets or sets the triggers. - /// </summary> - /// <value>The triggers.</value> - public TaskTriggerInfo[] Triggers { get; set; } - - /// <summary> - /// Gets or sets the description. - /// </summary> - /// <value>The description.</value> - public string Description { get; set; } - - /// <summary> - /// Gets or sets the category. - /// </summary> - /// <value>The category.</value> - public string Category { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance is hidden. - /// </summary> - /// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value> - public bool IsHidden { get; set; } - - /// <summary> - /// Gets or sets the key. - /// </summary> - /// <value>The key.</value> - public string Key { get; set; } - - /// <summary> - /// Initializes a new instance of the <see cref="TaskInfo"/> class. - /// </summary> - public TaskInfo() - { - Triggers = new TaskTriggerInfo[]{}; - } - } -} diff --git a/MediaBrowser.Model/Tasks/TaskResult.cs b/MediaBrowser.Model/Tasks/TaskResult.cs deleted file mode 100644 index 39eacdf66..000000000 --- a/MediaBrowser.Model/Tasks/TaskResult.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Class TaskExecutionInfo - /// </summary> - public class TaskResult - { - /// <summary> - /// Gets or sets the start time UTC. - /// </summary> - /// <value>The start time UTC.</value> - public DateTime StartTimeUtc { get; set; } - - /// <summary> - /// Gets or sets the end time UTC. - /// </summary> - /// <value>The end time UTC.</value> - public DateTime EndTimeUtc { get; set; } - - /// <summary> - /// Gets or sets the status. - /// </summary> - /// <value>The status.</value> - public TaskCompletionStatus Status { get; set; } - - /// <summary> - /// Gets or sets the name. - /// </summary> - /// <value>The name.</value> - public string Name { get; set; } - - /// <summary> - /// Gets or sets the key. - /// </summary> - /// <value>The key.</value> - public string Key { get; set; } - - /// <summary> - /// Gets or sets the id. - /// </summary> - /// <value>The id.</value> - public string Id { get; set; } - - /// <summary> - /// Gets or sets the error message. - /// </summary> - /// <value>The error message.</value> - public string ErrorMessage { get; set; } - - /// <summary> - /// Gets or sets the long error message. - /// </summary> - /// <value>The long error message.</value> - public string LongErrorMessage { get; set; } - } -} diff --git a/MediaBrowser.Model/Tasks/TaskState.cs b/MediaBrowser.Model/Tasks/TaskState.cs deleted file mode 100644 index 889ce6875..000000000 --- a/MediaBrowser.Model/Tasks/TaskState.cs +++ /dev/null @@ -1,22 +0,0 @@ - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Enum TaskState - /// </summary> - public enum TaskState - { - /// <summary> - /// The idle - /// </summary> - Idle, - /// <summary> - /// The cancelling - /// </summary> - Cancelling, - /// <summary> - /// The running - /// </summary> - Running - } -} diff --git a/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs b/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs deleted file mode 100644 index 69578c41d..000000000 --- a/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; - -namespace MediaBrowser.Model.Tasks -{ - /// <summary> - /// Class TaskTriggerInfo - /// </summary> - public class TaskTriggerInfo - { - /// <summary> - /// Gets or sets the type. - /// </summary> - /// <value>The type.</value> - public string Type { get; set; } - - /// <summary> - /// Gets or sets the time of day. - /// </summary> - /// <value>The time of day.</value> - public long? TimeOfDayTicks { get; set; } - - /// <summary> - /// Gets or sets the interval. - /// </summary> - /// <value>The interval.</value> - public long? IntervalTicks { get; set; } - - /// <summary> - /// Gets or sets the system event. - /// </summary> - /// <value>The system event.</value> - public SystemEvent? SystemEvent { get; set; } - - /// <summary> - /// Gets or sets the day of week. - /// </summary> - /// <value>The day of week.</value> - public DayOfWeek? DayOfWeek { get; set; } - - /// <summary> - /// Gets or sets the maximum runtime ms. - /// </summary> - /// <value>The maximum runtime ms.</value> - public int? MaxRuntimeMs { get; set; } - - public const string TriggerDaily = "DailyTrigger"; - public const string TriggerWeekly = "WeeklyTrigger"; - public const string TriggerInterval = "IntervalTrigger"; - public const string TriggerSystemEvent = "SystemEventTrigger"; - public const string TriggerStartup = "StartupTrigger"; - } -} |
