jellyfin/MediaBrowser.Model/Tasks/ScheduledTaskHelpers.cs

45 lines
1.2 KiB
C#
Raw Normal View History


2016-10-23 19:47:34 +00:00
namespace MediaBrowser.Model.Tasks
2013-02-21 01:33:05 +00:00
{
/// <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)
2013-02-21 01:33:05 +00:00
{
var isHidden = false;
var configurableTask = task.ScheduledTask as IConfigurableScheduledTask;
if (configurableTask != null)
{
isHidden = configurableTask.IsHidden;
}
string key = task.ScheduledTask.Key;
2014-09-28 15:27:26 +00:00
2013-02-21 01:33:05 +00:00
return new TaskInfo
{
Name = task.Name,
2013-02-22 04:23:06 +00:00
CurrentProgressPercentage = task.CurrentProgress,
2013-02-21 01:33:05 +00:00
State = task.State,
2014-05-09 19:43:06 +00:00
Id = task.Id,
2013-02-21 01:33:05 +00:00
LastExecutionResult = task.LastExecutionResult,
2014-09-28 15:27:26 +00:00
Triggers = task.Triggers,
2014-09-28 15:27:26 +00:00
2013-02-21 01:33:05 +00:00
Description = task.Description,
Category = task.Category,
2014-04-03 22:50:04 +00:00
IsHidden = isHidden,
Key = key
2013-02-21 01:33:05 +00:00
};
}
}
}