|
|
@@ -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)
|
|
|
{
|