From 6a4824c02932ee1bd57c1f4f0644f8bc693f6006 Mon Sep 17 00:00:00 2001 From: diamondpete <87245367+diamondpete@users.noreply.github.com> Date: Wed, 17 Jul 2024 00:36:29 -0400 Subject: [PATCH] Fixed: Remove apostrophe, backtick in contractions --- .../FileNameBuilderTests/CleanTitleFixture.cs | 8 ++++++++ src/NzbDrone.Core/Organizer/FileNameBuilder.cs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/CleanTitleFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/CleanTitleFixture.cs index 674522748..c4b1de610 100644 --- a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/CleanTitleFixture.cs +++ b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/CleanTitleFixture.cs @@ -72,6 +72,14 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests [TestCase("I'm the Boss", "Im the Boss")] [TestCase("The Title's", "The Title's")] [TestCase("I'm after I'm", "Im after I'm")] + [TestCase("I've Been Caught", "Ive Been Caught")] + [TestCase("I'm Lost", "Im Lost")] + [TestCase("That'll Be The Day", "Thatll Be The Day")] + [TestCase("I'd Rather Be Alone", "Id Rather Be Alone")] + [TestCase("I Can't Die", "I Cant Die")] + [TestCase("Won`t Get Fooled Again", "Wont Get Fooled Again")] + [TestCase("Don’t Blink", "Dont Blink")] + [TestCase("The ` Legend of Kings", "The Legend of Kings")] // [TestCase("", "")] public void should_get_expected_title_back(string title, string expected) diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index 3755f17f7..952b8f593 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -72,7 +72,7 @@ namespace NzbDrone.Core.Organizer private static readonly Regex FileNameCleanupRegex = new Regex(@"([- ._])(\1)+", RegexOptions.Compiled); private static readonly Regex TrimSeparatorsRegex = new Regex(@"[- ._]+$", RegexOptions.Compiled); - private static readonly Regex ScenifyRemoveChars = new Regex(@"(?<=\s)(,|<|>|\/|\\|;|:|'|""|\||`|~|!|\?|@|$|%|^|\*|-|_|=){1}(?=\s)|('|:|\?|,)(?=(?:(?:s|m)\s)|\s|$)|(\(|\)|\[|\]|\{|\})", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex ScenifyRemoveChars = new Regex(@"(?<=\s)(,|<|>|\/|\\|;|:|'|""|\||`|’|~|!|\?|@|$|%|^|\*|-|_|=){1}(?=\s)|('|`|’|:|\?|,)(?=(?:(?:s|m|t|ve|ll|d|re)\s)|\s|$)|(\(|\)|\[|\]|\{|\})", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex ScenifyReplaceChars = new Regex(@"[\/]", RegexOptions.Compiled | RegexOptions.IgnoreCase); // TODO: Support Written numbers (One, Two, etc) and Roman Numerals (I, II, III etc)