mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-19 06:00:41 +01:00
Merge pull request #17112 from theguymadmax/add-year-to-series-resolver
Fix series year lost during name parsing
This commit is contained in:
@@ -25,5 +25,11 @@ namespace Emby.Naming.TV
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name of the series.</value>
|
/// <value>The name of the series.</value>
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the year of the series.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The year of the series.</value>
|
||||||
|
public int? Year { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Emby.Naming.TV
|
|||||||
/// Regex that matches titles with year in parentheses. Captures the title (which may be
|
/// Regex that matches titles with year in parentheses. Captures the title (which may be
|
||||||
/// numeric) before the year, i.e. turns "1923 (2022)" into "1923".
|
/// numeric) before the year, i.e. turns "1923 (2022)" into "1923".
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[GeneratedRegex(@"(?<title>.+?)\s*\(\d{4}\)")]
|
[GeneratedRegex(@"(?<title>.+?)\s*\((?<year>[0-9]{4})\)")]
|
||||||
private static partial Regex TitleWithYearRegex();
|
private static partial Regex TitleWithYearRegex();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -43,7 +43,8 @@ namespace Emby.Naming.TV
|
|||||||
seriesName = titleWithYearMatch.Groups["title"].Value.Trim();
|
seriesName = titleWithYearMatch.Groups["title"].Value.Trim();
|
||||||
return new SeriesInfo(path)
|
return new SeriesInfo(path)
|
||||||
{
|
{
|
||||||
Name = seriesName
|
Name = seriesName,
|
||||||
|
Year = int.TryParse(titleWithYearMatch.Groups["year"].ValueSpan, out var year) ? year : null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
return new Series
|
return new Series
|
||||||
{
|
{
|
||||||
Path = args.Path,
|
Path = args.Path,
|
||||||
Name = seriesInfo.Name
|
Name = seriesInfo.Name,
|
||||||
|
ProductionYear = seriesInfo.Year
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user