mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-03 05:34:21 -04:00
27 lines
582 B
C#
27 lines
582 B
C#
using System.Collections.Generic;
|
|
using Hangfire;
|
|
|
|
namespace API.Helpers.Converters;
|
|
#nullable enable
|
|
|
|
public static class CronConverter
|
|
{
|
|
public static readonly IEnumerable<string> Options = new []
|
|
{
|
|
"disabled",
|
|
"daily",
|
|
"weekly",
|
|
};
|
|
public static string ConvertToCronNotation(string source)
|
|
{
|
|
return source.ToLower() switch
|
|
{
|
|
"daily" => Cron.Daily(),
|
|
"weekly" => Cron.Weekly(),
|
|
"disabled" => Cron.Never(),
|
|
"" => Cron.Never(),
|
|
_ => source
|
|
};
|
|
}
|
|
}
|