2018-12-27 23:27:57 +00:00
|
|
|
namespace MediaBrowser.Model.Tasks
|
|
|
|
{
|
|
|
|
/// <summary>
|
2020-02-04 00:49:27 +00:00
|
|
|
/// Class ScheduledTaskHelpers.
|
2018-12-27 23:27:57 +00:00
|
|
|
/// </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
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|