mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-12-26 17:36:52 +00:00
Implement TaskTriggerInfoType enum (#12783)
This commit is contained in:
parent
9ae1ac2513
commit
06923cbf2b
|
@ -471,7 +471,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||
new()
|
||||
{
|
||||
IntervalTicks = TimeSpan.FromDays(1).Ticks,
|
||||
Type = TaskTriggerInfo.TriggerInterval
|
||||
Type = TaskTriggerInfoType.IntervalTrigger
|
||||
}
|
||||
];
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||
MaxRuntimeTicks = info.MaxRuntimeTicks
|
||||
};
|
||||
|
||||
if (info.Type.Equals(nameof(DailyTrigger), StringComparison.OrdinalIgnoreCase))
|
||||
if (info.Type == TaskTriggerInfoType.DailyTrigger)
|
||||
{
|
||||
if (!info.TimeOfDayTicks.HasValue)
|
||||
{
|
||||
|
@ -626,7 +626,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||
return new DailyTrigger(TimeSpan.FromTicks(info.TimeOfDayTicks.Value), options);
|
||||
}
|
||||
|
||||
if (info.Type.Equals(nameof(WeeklyTrigger), StringComparison.OrdinalIgnoreCase))
|
||||
if (info.Type == TaskTriggerInfoType.WeeklyTrigger)
|
||||
{
|
||||
if (!info.TimeOfDayTicks.HasValue)
|
||||
{
|
||||
|
@ -641,7 +641,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||
return new WeeklyTrigger(TimeSpan.FromTicks(info.TimeOfDayTicks.Value), info.DayOfWeek.Value, options);
|
||||
}
|
||||
|
||||
if (info.Type.Equals(nameof(IntervalTrigger), StringComparison.OrdinalIgnoreCase))
|
||||
if (info.Type == TaskTriggerInfoType.IntervalTrigger)
|
||||
{
|
||||
if (!info.IntervalTicks.HasValue)
|
||||
{
|
||||
|
@ -651,7 +651,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||
return new IntervalTrigger(TimeSpan.FromTicks(info.IntervalTicks.Value), options);
|
||||
}
|
||||
|
||||
if (info.Type.Equals(nameof(StartupTrigger), StringComparison.OrdinalIgnoreCase))
|
||||
if (info.Type == TaskTriggerInfoType.StartupTrigger)
|
||||
{
|
||||
return new StartupTrigger(options);
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public partial class AudioNormalizationTask : IScheduledTask
|
|||
[
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval,
|
||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||
}
|
||||
];
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||
[
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerDaily,
|
||||
Type = TaskTriggerInfoType.DailyTrigger,
|
||||
TimeOfDayTicks = TimeSpan.FromHours(2).Ticks,
|
||||
MaxRuntimeTicks = TimeSpan.FromHours(4).Ticks
|
||||
}
|
||||
|
|
|
@ -135,6 +135,6 @@ public class CleanupCollectionAndPlaylistPathsTask : IScheduledTask
|
|||
/// <inheritdoc />
|
||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||
{
|
||||
return [new TaskTriggerInfo() { Type = TaskTriggerInfo.TriggerStartup }];
|
||||
return [new TaskTriggerInfo() { Type = TaskTriggerInfoType.StartupTrigger }];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||
return
|
||||
[
|
||||
// Every so often
|
||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
||||
new TaskTriggerInfo { Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||
{
|
||||
return
|
||||
[
|
||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
||||
new TaskTriggerInfo { Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -69,11 +69,11 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||
[
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerStartup
|
||||
Type = TaskTriggerInfoType.StartupTrigger
|
||||
},
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval,
|
||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||
}
|
||||
];
|
||||
|
|
|
@ -111,7 +111,7 @@ public class MediaSegmentExtractionTask : IScheduledTask
|
|||
{
|
||||
yield return new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval,
|
||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||
IntervalTicks = TimeSpan.FromHours(12).Ticks
|
||||
};
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||
return
|
||||
[
|
||||
// Every so often
|
||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
||||
new TaskTriggerInfo { Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||
{
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval,
|
||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||
IntervalTicks = TimeSpan.FromDays(7).Ticks
|
||||
}
|
||||
};
|
||||
|
|
|
@ -60,10 +60,10 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||
{
|
||||
// At startup
|
||||
yield return new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerStartup };
|
||||
yield return new TaskTriggerInfo { Type = TaskTriggerInfoType.StartupTrigger };
|
||||
|
||||
// Every so often
|
||||
yield return new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks };
|
||||
yield return new TaskTriggerInfo { Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks };
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||
{
|
||||
yield return new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval,
|
||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||
IntervalTicks = TimeSpan.FromHours(12).Ticks
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,31 +8,11 @@ namespace MediaBrowser.Model.Tasks
|
|||
/// </summary>
|
||||
public class TaskTriggerInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The daily trigger.
|
||||
/// </summary>
|
||||
public const string TriggerDaily = "DailyTrigger";
|
||||
|
||||
/// <summary>
|
||||
/// The weekly trigger.
|
||||
/// </summary>
|
||||
public const string TriggerWeekly = "WeeklyTrigger";
|
||||
|
||||
/// <summary>
|
||||
/// The interval trigger.
|
||||
/// </summary>
|
||||
public const string TriggerInterval = "IntervalTrigger";
|
||||
|
||||
/// <summary>
|
||||
/// The startup trigger.
|
||||
/// </summary>
|
||||
public const string TriggerStartup = "StartupTrigger";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public string Type { get; set; }
|
||||
public TaskTriggerInfoType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time of day.
|
||||
|
|
28
MediaBrowser.Model/Tasks/TaskTriggerInfoType.cs
Normal file
28
MediaBrowser.Model/Tasks/TaskTriggerInfoType.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum TaskTriggerInfoType.
|
||||
/// </summary>
|
||||
public enum TaskTriggerInfoType
|
||||
{
|
||||
/// <summary>
|
||||
/// The daily trigger.
|
||||
/// </summary>
|
||||
DailyTrigger,
|
||||
|
||||
/// <summary>
|
||||
/// The weekly trigger.
|
||||
/// </summary>
|
||||
WeeklyTrigger,
|
||||
|
||||
/// <summary>
|
||||
/// The interval trigger.
|
||||
/// </summary>
|
||||
IntervalTrigger,
|
||||
|
||||
/// <summary>
|
||||
/// The startup trigger.
|
||||
/// </summary>
|
||||
StartupTrigger
|
||||
}
|
||||
}
|
|
@ -162,7 +162,7 @@ public class LyricScheduledTask : IScheduledTask
|
|||
[
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval,
|
||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||
}
|
||||
];
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
return new[]
|
||||
{
|
||||
// Every so often
|
||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
||||
new TaskTriggerInfo { Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class TrickplayImagesTask : IScheduledTask
|
|||
{
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerDaily,
|
||||
Type = TaskTriggerInfoType.DailyTrigger,
|
||||
TimeOfDayTicks = TimeSpan.FromHours(3).Ticks
|
||||
}
|
||||
};
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace Jellyfin.LiveTv.Channels
|
|||
// Every so often
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||
Type = TaskTriggerInfoType.IntervalTrigger, IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class RefreshGuideScheduledTask : IScheduledTask, IConfigurableScheduledT
|
|||
{
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval,
|
||||
Type = TaskTriggerInfoType.IntervalTrigger,
|
||||
IntervalTicks = TimeSpan.FromHours(24).Ticks
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue