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:
parent
73208e2f60
commit
22005dc8c5
@ -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();
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user