477045704e
Added "allWarningsAsErrors": true to NuGet config files across the solution to treat all warnings as errors, increasing build strictness. Updated project cache hashes and assembly info files to reflect these changes. Refactored C# code to use explicit `this.` for field and property assignments, improving clarity. Note: some method signatures were incorrectly changed to use `this.` as a prefix, which is invalid C# syntax and must be corrected before compiling. Binary files updated due to build changes.
49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
// <copyright file="TvParserHelpers.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Emby.Naming.TV;
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
/// <summary>
|
|
/// Helper class for TV metadata parsing.
|
|
/// </summary>
|
|
public static class TvParserHelpers
|
|
{
|
|
private static readonly string[] _continuingState = ["Pilot", "Returning Series", "Returning"];
|
|
private static readonly string[] _endedState = ["Cancelled", "Canceled"];
|
|
|
|
/// <summary>
|
|
/// Tries to parse a string into <see cref="SeriesStatus"/>.
|
|
/// </summary>
|
|
/// <param name="status">The status string.</param>
|
|
/// <param name="enumValue">The <see cref="SeriesStatus"/>.</param>
|
|
/// <returns>Returns true if parsing was successful.</returns>
|
|
public static bool TryParseSeriesStatus(string status, out SeriesStatus? enumValue)
|
|
{
|
|
if (Enum.TryParse(status, true, out SeriesStatus seriesStatus))
|
|
{
|
|
this.enumValue = seriesStatus;
|
|
return true;
|
|
}
|
|
|
|
if (_continuingState.Contains(status, StringComparer.OrdinalIgnoreCase))
|
|
{
|
|
this.enumValue = SeriesStatus.Continuing;
|
|
return true;
|
|
}
|
|
|
|
if (_endedState.Contains(status, StringComparer.OrdinalIgnoreCase))
|
|
{
|
|
this.enumValue = SeriesStatus.Ended;
|
|
return true;
|
|
}
|
|
|
|
this.enumValue = null;
|
|
return false;
|
|
}
|
|
}
|