From 574f05e29682c395b3b6d326d47be9fa7cd637b1 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 29 Aug 2021 20:15:27 -0700 Subject: [PATCH] Fixed: Parsing of some multi-episode titles Closes #4612 --- src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs | 1 + src/NzbDrone.Core/Parser/Parser.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs index c6c45737c..c0ceef09f 100644 --- a/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs @@ -71,6 +71,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Series Title - [02x01-x02] - Episode 1", "Series Title", 2, new [] { 1, 2})] [TestCase("Series Title - [02x01-02] - Episode 1", "Series Title", 2, new [] { 1, 2})] [TestCase("Series Title (2011) - S01E23-E24 - ...E i nuovi orizzonti [HDTV 360p] [ITA].mkv", "Series Title (2011)", 1, new [] { 23, 24 })] + [TestCase("The Series Title! - S01E01-02-03", "The Series Title!", 1, new [] { 1, 2, 3 })] //[TestCase("", "", , new [] { })] public void should_parse_multiple_episodes(string postTitle, string title, int season, int[] episodes) { diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index b5109aa48..f03206701 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -138,7 +138,7 @@ namespace NzbDrone.Core.Parser RegexOptions.IgnoreCase | RegexOptions.Compiled), // Multi-episode with title (S01E05-06, S01E05-6) - new Regex(@"^(?.+?)(?:[-_\W](?<![()\[!]))+S(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))E(?<episode>\d{1,2}(?!\d+))(?:-(?<episode>\d{1,2}(?!\d+)))+[-_. ]", + new Regex(@"^(?<title>.+?)(?:[-_\W](?<![()\[!]))+S(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))E(?<episode>\d{1,2}(?!\d+))(?:-(?<episode>\d{1,2}(?!\d+)))+(?:[-_. ]|$)", RegexOptions.IgnoreCase | RegexOptions.Compiled), //Episodes with a title, Single episodes (S01E05, 1x05, etc) & Multi-episode (S01E05E06, S01E05-06, S01E05 E06, etc)