diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-07-25 16:21:26 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-07-25 16:21:26 +0200 |
| commit | d1d89dfb12a0e10afb088cca7a2dd02a76d3ebaf (patch) | |
| tree | a48f25bc66d72cbfa403846ff8d7535f9e7b1ce0 | |
| parent | 45ec0ed8b5cd92226ff7767d654dd93b1a2036f5 (diff) | |
Fix hyphenated numbers in episode titles parsed as multi-episodes
| -rw-r--r-- | Emby.Naming/Common/NamingOptions.cs | 5 | ||||
| -rw-r--r-- | tests/Jellyfin.Naming.Tests/TV/MultiEpisodeTests.cs | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs index fb1b2b523b..0d93403758 100644 --- a/Emby.Naming/Common/NamingOptions.cs +++ b/Emby.Naming/Common/NamingOptions.cs @@ -361,7 +361,10 @@ namespace Emby.Naming.Common // Not a Kodi rule as well, but the expression below also causes false positives, // so we make sure this one gets tested first. // "Foo Bar 889" - new EpisodeExpression(@".*[\\\/](?![Ee]pisode)(?<seriesname>[\w\s]+?)\s(?<epnumber>[0-9]{1,4})(-(?<endingepnumber>[0-9]{2,4}))*[^\\\/x]*$") + // Names carrying an SxxEyy marker are excluded because the Kodi expression above already covers them. + // Without that guard this expression reads digits out of the title instead, turning + // "S01E01 1-23-45 [Bluray-1080p]" into episodes 1 through 45. + new EpisodeExpression(@".*[\\\/](?![Ee]pisode)(?![^\\\/]*[Ss][0-9]+[][ ._-]*[Ee][0-9]+)(?<seriesname>[\w\s]+?)\s(?<epnumber>[0-9]{1,4})(-(?<endingepnumber>[0-9]{2,4}))*[^\\\/x]*$") { IsNamed = true }, diff --git a/tests/Jellyfin.Naming.Tests/TV/MultiEpisodeTests.cs b/tests/Jellyfin.Naming.Tests/TV/MultiEpisodeTests.cs index b441e49b19..7e708c681d 100644 --- a/tests/Jellyfin.Naming.Tests/TV/MultiEpisodeTests.cs +++ b/tests/Jellyfin.Naming.Tests/TV/MultiEpisodeTests.cs @@ -69,6 +69,11 @@ namespace Jellyfin.Naming.Tests.TV [InlineData("Season 1/series-s09e14-720i.mkv", null)] [InlineData("Season 1/MOONLIGHTING_s01e01-e04.mkv", 4)] [InlineData("Season 1/MOONLIGHTING_s01e01-e04", 4)] + // Hyphenated numbers in the episode title must not be read as an episode range + [InlineData("Season 1/S01E01 The 6-10 to Lubbock [WEBRip-1080p][AV1 Opus].mkv", null)] + [InlineData("Season 5/S05E23 11-59 [HDTV-1080p][x265 AC3].mkv", null)] + [InlineData("Season 5/S05E23 11-59 [HDTV-1080p][HEVC AC3].mkv", null)] + [InlineData("Season 1/S01E01 1-23-45 [Bluray-1080p][AV1 Opus].mkv", null)] public void TestGetEndingEpisodeNumberFromFile(string filename, int? endingEpisodeNumber) { var result = _episodePathParser.Parse(filename, false); |
