From 1be44a4254bc233dd382ae5c91d66b6c8de02b35 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 26 Dec 2014 17:36:42 -0800 Subject: [PATCH] Couple more test cases for episode title collapse --- .../FileNameBuilderTests/EpisodeTitleCollapseFixture.cs | 3 +++ src/NzbDrone.Core/Organizer/FileNameBuilder.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/EpisodeTitleCollapseFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/EpisodeTitleCollapseFixture.cs index b417b5a94..13e8ecb85 100644 --- a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/EpisodeTitleCollapseFixture.cs +++ b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/EpisodeTitleCollapseFixture.cs @@ -68,6 +68,9 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests [TestCase("Hey, Baby, What's Wrong (1)", "Hey, Baby, What's Wrong (2)", "Hey, Baby, What's Wrong")] [TestCase("Meet the Guys and Girls of Cycle 20 Part 1", "Meet the Guys and Girls of Cycle 20 Part 2", "Meet the Guys and Girls of Cycle 20")] + [TestCase("Meet the Guys and Girls of Cycle 20 Part1", "Meet the Guys and Girls of Cycle 20 Part2", "Meet the Guys and Girls of Cycle 20")] + [TestCase("Meet the Guys and Girls of Cycle 20 Part01", "Meet the Guys and Girls of Cycle 20 Part02", "Meet the Guys and Girls of Cycle 20")] + [TestCase("Meet the Guys and Girls of Cycle 20 Part 01", "Meet the Guys and Girls of Cycle 20 Part 02", "Meet the Guys and Girls of Cycle 20")] [TestCase("Meet the Guys and Girls of Cycle 20 part 1", "Meet the Guys and Girls of Cycle 20 part 2", "Meet the Guys and Girls of Cycle 20")] public void should_collapse_episode_titles_when_episode_titles_are_the_same(string title1, string title2, string expected) { diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index b61b09f52..8ac1e52b4 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -59,7 +59,7 @@ namespace NzbDrone.Core.Organizer private static readonly Regex ScenifyRemoveChars = new Regex(@"(?<=\s)(,|<|>|\/|\\|;|:|'|""|\||`|~|!|\?|@|$|%|^|\*|-|_|=){1}(?=\s)|('|:|\?|,)(?=(?:(?:s|m)\s)|\s|$)|(\(|\)|\[|\]|\{|\})", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex ScenifyReplaceChars = new Regex(@"[\/]", RegexOptions.Compiled | RegexOptions.IgnoreCase); - private static readonly Regex MultiPartCleanupRegex = new Regex(@"(?:\(\d+\)|Part\s\d+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex MultiPartCleanupRegex = new Regex(@"(?:\(\d+\)|Part\s?\d+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly char[] EpisodeTitleTrimCharacters = new[] { ' ', '.', '?' };