2017-08-09 12:56:38 -07:00
|
|
|
|
|
2016-10-23 12:47:34 -07:00
|
|
|
|
namespace MediaBrowser.Model.Tasks
|
2013-02-20 18:33:05 -07:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class ScheduledTaskHelpers
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class ScheduledTaskHelpers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the task info.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="task">The task.</param>
|
|
|
|
|
/// <returns>TaskInfo.</returns>
|
2013-02-25 20:43:04 -07:00
|
|
|
|
public static TaskInfo GetTaskInfo(IScheduledTaskWorker task)
|
2013-02-20 18:33:05 -07:00
|
|
|
|
{
|
2013-11-29 09:58:24 -07:00
|
|
|
|
var isHidden = false;
|
|
|
|
|
|
|
|
|
|
var configurableTask = task.ScheduledTask as IConfigurableScheduledTask;
|
|
|
|
|
|
|
|
|
|
if (configurableTask != null)
|
|
|
|
|
{
|
|
|
|
|
isHidden = configurableTask.IsHidden;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-23 12:14:57 -07:00
|
|
|
|
string key = task.ScheduledTask.Key;
|
2014-09-28 08:27:26 -07:00
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
return new TaskInfo
|
|
|
|
|
{
|
|
|
|
|
Name = task.Name,
|
2013-02-21 21:23:06 -07:00
|
|
|
|
CurrentProgressPercentage = task.CurrentProgress,
|
2013-02-20 18:33:05 -07:00
|
|
|
|
State = task.State,
|
2014-05-09 12:43:06 -07:00
|
|
|
|
Id = task.Id,
|
2013-02-20 18:33:05 -07:00
|
|
|
|
LastExecutionResult = task.LastExecutionResult,
|
2014-09-28 08:27:26 -07:00
|
|
|
|
|
2017-08-09 12:56:38 -07:00
|
|
|
|
Triggers = task.Triggers,
|
2014-09-28 08:27:26 -07:00
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
Description = task.Description,
|
2013-11-29 09:58:24 -07:00
|
|
|
|
Category = task.Category,
|
2014-04-03 15:50:04 -07:00
|
|
|
|
IsHidden = isHidden,
|
|
|
|
|
Key = key
|
2013-02-20 18:33:05 -07:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|