diff options
| author | Cody Engel <cengel815@gmail.com> | 2025-09-20 14:04:00 -0600 |
|---|---|---|
| committer | Cody Engel <cengel815@gmail.com> | 2025-09-20 14:04:00 -0600 |
| commit | da31d0c6a61ff0d908ad3c9ddcfa42a055f7ef6f (patch) | |
| tree | 1ece589f80b7ce0bc704f8dfae007296aee55eb5 /Emby.Naming | |
| parent | 424682523961f1a51fdebcde4f64849b75b9c3af (diff) | |
support series that are numeric only
updates SeriesResolver to handle series names that only contain numbers such as 1923.
Diffstat (limited to 'Emby.Naming')
| -rw-r--r-- | Emby.Naming/TV/SeriesResolver.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Emby.Naming/TV/SeriesResolver.cs b/Emby.Naming/TV/SeriesResolver.cs index c955b8a0d..795c63509 100644 --- a/Emby.Naming/TV/SeriesResolver.cs +++ b/Emby.Naming/TV/SeriesResolver.cs @@ -18,6 +18,13 @@ namespace Emby.Naming.TV 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> /// <param name="options"><see cref="NamingOptions"/> object passed to <see cref="SeriesPathParser"/>.</param> @@ -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) { |
