Implement episode metadata management: add functionality to refresh episode metadata from external sources, including new API endpoints and UI integration. Enhance Show and Episode models to support additional metadata fields, and update database schema accordingly. Update ShowDetail and ShowMetadataCard components to display refreshed episode information and provide user feedback on metadata updates.

This commit is contained in:
Leonid Pershin
2026-07-25 09:46:19 +03:00
parent 0d2dee815e
commit 7fb46b5e0d
30 changed files with 1563 additions and 81 deletions
@@ -17,21 +17,35 @@ public static class EpisodeName
RegexOptions.Compiled | RegexOptions.IgnoreCase
);
// Ведущий номер серии: «01. Название», «02 - Название», «03_Название» — сезон считаем первым.
private static readonly Regex LeadingNumber = new(
@"^\s*(\d{1,3})[\s._)\]-]",
RegexOptions.Compiled
);
public static (int Season, int Episode)? Parse(string? name)
{
if (string.IsNullOrEmpty(name))
return null;
var match = SxxEyy.Match(name);
if (!match.Success)
match = NxNN.Match(name);
if (match.Success)
return (Int(match, 1), Int(match, 2));
return match.Success
? (int.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture),
int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture))
: null;
match = NxNN.Match(name);
if (match.Success)
return (Int(match, 1), Int(match, 2));
match = LeadingNumber.Match(name);
if (match.Success)
return (1, Int(match, 1));
return null;
}
private static int Int(Match match, int group) =>
int.Parse(match.Groups[group].Value, CultureInfo.InvariantCulture);
public static int? ParseSeason(string? name) => Parse(name)?.Season;
/// <summary>Метка вида «S16E03», либо null если распознать не удалось.</summary>