Fixed: Cleaning the French preposition 'à' from titles

pull/7359/head
Bogdan 4 months ago committed by Mark McDowall
parent 73208e2f60
commit 22005dc8c5

@ -24,6 +24,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("test/test", "testtest")]
[TestCase("90210", "90210")]
[TestCase("24", "24")]
[TestCase("Test: Something à Deux", "testsomethingdeux")]
[TestCase("Parler à", "parlera")]
public void should_remove_special_characters_and_casing(string dirty, string clean)
{
var result = dirty.CleanSeriesTitle();

@ -517,7 +517,7 @@ namespace NzbDrone.Core.Parser
// Regex to detect whether the title was reversed.
private static readonly Regex ReversedTitleRegex = new Regex(@"(?:^|[-._ ])(p027|p0801|\d{2,3}E\d{2}S)[-._ ]", RegexOptions.Compiled);
private static readonly RegexReplace NormalizeRegex = new RegexReplace(@"((?:\b|_)(?<!^)(a(?!$)|an|the|and|or|of)(?!$)(?:\b|_))|\W|_",
private static readonly RegexReplace NormalizeRegex = new RegexReplace(@"((?:\b|_)(?<!^)([aà](?!$)|an|the|and|or|of)(?!$)(?:\b|_))|\W|_",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);
@ -845,7 +845,7 @@ namespace NzbDrone.Core.Parser
// Replace `%` with `percent` to deal with the 3% case
title = PercentRegex.Replace(title, "percent");
return NormalizeRegex.Replace(title).ToLower().RemoveAccent();
return NormalizeRegex.Replace(title).ToLowerInvariant().RemoveAccent();
}
public static string NormalizeEpisodeTitle(string title)

Loading…
Cancel
Save