1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-10 23:29:53 +02:00

Fixed: Cleaning the French preposition 'à' from titles

This commit is contained in:
Bogdan 2024-10-31 10:57:43 +02:00 committed by Mark McDowall
parent 73208e2f60
commit 22005dc8c5
2 changed files with 4 additions and 2 deletions

View File

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

View File

@ -517,7 +517,7 @@ public static class Parser
// Regex to detect whether the title was reversed. // 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 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, string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
@ -845,7 +845,7 @@ public static string CleanSeriesTitle(this string title)
// Replace `%` with `percent` to deal with the 3% case // Replace `%` with `percent` to deal with the 3% case
title = PercentRegex.Replace(title, "percent"); title = PercentRegex.Replace(title, "percent");
return NormalizeRegex.Replace(title).ToLower().RemoveAccent(); return NormalizeRegex.Replace(title).ToLowerInvariant().RemoveAccent();
} }
public static string NormalizeEpisodeTitle(string title) public static string NormalizeEpisodeTitle(string title)