1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-12 11:15:43 +02:00

New: Parsing of multi-episode files in brackets

Closes #5501
This commit is contained in:
Mark McDowall 2023-03-26 21:39:01 -07:00
parent 0f6f681438
commit 5ea1fb9424
3 changed files with 16 additions and 1 deletions

View File

@ -270,5 +270,15 @@ public void should_format_prefixed_range_multi_episode_using_episode_separator()
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
.Should().Be("South Park - 15x06-x08 - City Sushi");
}
[Test]
public void should_format_range_multi_episode_wrapped_in_brackets()
{
_namingConfig.StandardEpisodeFormat = "{Series Title} (S{season:00}E{episode:00}) {Episode Title}";
_namingConfig.MultiEpisodeStyle = 4;
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
.Should().Be("South Park (S15E06-08) City Sushi");
}
}
}

View File

@ -74,6 +74,7 @@ public class MultiEpisodeParserFixture : CoreTest
[TestCase("Series Title! (2013) - S04E44-E45 - Il 200 spettacolare episodio da narcisisti! [NetflixHD 720p HEVC] [ITA+ENG].mkv", "Series Title! (2013)", 4, new[] { 44, 45 })]
[TestCase("13 Series Se.1 afl.2-3-4 [VTM]", "13 Series", 1, new[] { 2, 3, 4 })]
[TestCase("Series T Se.3 afl.3 en 4", "Series T", 3, new[] { 3, 4 })]
[TestCase("Series Title (S15E06-08) City Sushi", "Series Title", 15, new[] { 6, 7, 8 })]
// [TestCase("", "", , new [] { })]
public void should_parse_multiple_episodes(string postTitle, string title, int season, int[] episodes)

View File

@ -231,6 +231,10 @@ public static class Parser
new Regex(@"(?:.*(?:^))(?<title>.*?)[-._ ]+\[S(?<season>(?<!\d+)\d{2}(?!\d+))(?:[E-]{1,2}(?<episode>(?<!\d+)\d{2}(?!\d+)))+\]",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
// Multi-episode with episodes in brackets (Series Title (S01E11E12) or Series Title (S01E11-12))
new Regex(@"(?:.*(?:^))(?<title>.*?)[-._ ]+\(S(?<season>(?<!\d+)\d{2}(?!\d+))(?:[E-]{1,2}(?<episode>(?<!\d+)\d{2}(?!\d+)))+\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
// Multi-episode release with no space between series title and season (S01E11E12)
new Regex(@"(?:.*(?:^))(?<title>.*?)S(?<season>(?<!\d+)\d{2}(?!\d+))(?:E(?<episode>(?<!\d+)\d{2}(?!\d+)))+",
RegexOptions.IgnoreCase | RegexOptions.Compiled),