You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Controller/Library/TVUtils.cs

50 lines
1.3 KiB

using System;
using System.Diagnostics.CodeAnalysis;
6 years ago
namespace MediaBrowser.Controller.Library
{
/// <summary>
/// Class TVUtils.
6 years ago
/// </summary>
public static class TVUtils
{
/// <summary>
/// Gets the air days.
/// </summary>
/// <param name="day">The day.</param>
/// <returns>List{DayOfWeek}.</returns>
[return: NotNullIfNotNull("day")]
public static DayOfWeek[] GetAirDays(string? day)
6 years ago
{
if (!string.IsNullOrEmpty(day))
{
if (string.Equals(day, "Daily", StringComparison.OrdinalIgnoreCase))
{
return new[]
{
DayOfWeek.Sunday,
DayOfWeek.Monday,
DayOfWeek.Tuesday,
DayOfWeek.Wednesday,
DayOfWeek.Thursday,
DayOfWeek.Friday,
DayOfWeek.Saturday
};
6 years ago
}
if (Enum.TryParse(day, true, out DayOfWeek value))
6 years ago
{
return new[]
{
value
};
6 years ago
}
4 years ago
return Array.Empty<DayOfWeek>();
6 years ago
}
6 years ago
return null;
}
}
}