From a81a80a00f09d7f0419a29d2c72df9556c63b687 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 15 May 2022 14:47:23 -0700 Subject: [PATCH] Fixed: Parsing of single episode numbers Closes #5022 --- .../ParserTests/SingleEpisodeParserFixture.cs | 2 ++ src/NzbDrone.Core/Parser/Parser.cs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs index 9def6863b..bc66f7241 100644 --- a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs @@ -149,6 +149,8 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Anime Title - S2010E994 [0994] [2010-02-28] - Episode Title [x264 720p][AAC 2ch][HS][Shion+GakiDave]", "Anime Title", 2010, 994)] [TestCase("Series Title - Temporada 2 [HDTV 720p][Cap.201][AC3 5.1 Castellano][www.pctnew.com]", "Series Title", 2, 1)] [TestCase("Series Title - Temporada 2 [HDTV 720p][Cap.1901][AC3 5.1 Castellano][www.pctnew.com]", "Series Title", 19, 1)] + [TestCase("Series Title 1x1", "Series Title", 1, 1)] + [TestCase("1x1", "", 1, 1)] //[TestCase("", "", 0, 0)] public void should_parse_single_episode(string postTitle, string title, int seasonNumber, int episodeNumber) { diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index e96c1dc22..155f87bd9 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -351,6 +351,10 @@ namespace NzbDrone.Core.Parser //Season only releases for poorly named anime new Regex(@"^(?:\[(?.+?)\][-_. ])?(?.+?)[-_. ]+?[\[(](?:S|Season|Saison|Series)[-_. ]?(?<season>\d{1,2}(?![-_. ]?\d+))(?:[-_. )\]]|$)+(?<extras>EXTRAS|SUBPACK)?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + + //Episodes without a title, Single episode numbers (S1E1, 1x1) + new Regex(@"^(?:S?(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:[-_ ]?[ex])(?<episode>\d{1}(?!\d+))))", + RegexOptions.IgnoreCase | RegexOptions.Compiled) };