The Free Software Media System - Server Backend & API
support series that are numeric only
Cody Engelda31d0c6a61f
diff --git a/Emby.Naming/TV/SeriesResolver.cs b/Emby.Naming/TV/SeriesResolver.csindex c955b8a0db..795c63509c 100644--- a/Emby.Naming/TV/SeriesResolver.cs+++ b/Emby.Naming/TV/SeriesResolver.cs@@ -17,6 +17,13 @@ namespace Emby.Naming.TV[GeneratedRegex(@"((?<a>[^\._]{2,})[\._]*)|([\._](?<b>[^\._]{2,}))")]private static partial Regex SeriesNameRegex();+ /// <summary>+ /// Regex that matches titles with year in parentheses, optionally preceded by a minus sign.+ /// Captures the title (which may be numeric) before the year.+ /// </summary>+ [GeneratedRegex(@"^-?(?<title>.+?)\s*\(\d{4}\)")]+ private static partial Regex TitleWithYearRegex();+/// <summary>/// Resolve information about series from path./// </summary>@@ -27,6 +34,20 @@ namespace Emby.Naming.TV{string seriesName = Path.GetFileName(path);+ // First check if the filename matches a title with year pattern (handles numeric titles)+ if (!string.IsNullOrEmpty(seriesName))+ {+ var titleWithYearMatch = TitleWithYearRegex().Match(seriesName);+ if (titleWithYearMatch.Success)+ {+ seriesName = titleWithYearMatch.Groups["title"].Value.Trim();+ return new SeriesInfo(path)+ {+ Name = seriesName+ };+ }+ }+SeriesPathParserResult result = SeriesPathParser.Parse(options, path);if (result.Success){diff --git a/tests/Jellyfin.Naming.Tests/TV/SeriesResolverTests.cs b/tests/Jellyfin.Naming.Tests/TV/SeriesResolverTests.csindex 84758c9c36..84311b0e20 100644--- a/tests/Jellyfin.Naming.Tests/TV/SeriesResolverTests.cs+++ b/tests/Jellyfin.Naming.Tests/TV/SeriesResolverTests.cs@@ -19,6 +19,8 @@ namespace Jellyfin.Naming.Tests.TV[InlineData("/some/path/The Show", "The Show")][InlineData("/some/path/The Show s02e10 720p hdtv", "The Show")][InlineData("/some/path/The Show s02e10 the episode 720p hdtv", "The Show")]+ [InlineData("/some/path/1923 (2022)", "1923")]+ [InlineData("/some/path/-1923 (2022)", "1923")]public void SeriesResolverResolveTest(string path, string name){var res = SeriesResolver.Resolve(_namingOptions, path);