mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-21 23:32:27 +00:00
Fixed: Cleaning the French preposition 'à' from names
(cherry picked from commit 22005dc8c500cd77e4a710248582cd4a0036988f) Closes #5213
This commit is contained in:
parent
fd3f493eb6
commit
e50e79167a
2 changed files with 4 additions and 2 deletions
|
@ -24,6 +24,8 @@ public void should_normalize_artist_title(string parsedArtistName, string artist
|
||||||
[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.CleanArtistName();
|
var result = dirty.CleanArtistName();
|
||||||
|
|
|
@ -154,7 +154,7 @@ public static class Parser
|
||||||
new Regex(@"^b00bs$", RegexOptions.Compiled | RegexOptions.IgnoreCase)
|
new Regex(@"^b00bs$", RegexOptions.Compiled | RegexOptions.IgnoreCase)
|
||||||
};
|
};
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ public static string CleanArtistName(this string name)
|
||||||
|
|
||||||
name = PercentRegex.Replace(name, "percent");
|
name = PercentRegex.Replace(name, "percent");
|
||||||
|
|
||||||
return NormalizeRegex.Replace(name).ToLower().RemoveAccent();
|
return NormalizeRegex.Replace(name).ToLowerInvariant().RemoveAccent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string NormalizeTrackTitle(this string title)
|
public static string NormalizeTrackTitle(this string title)
|
||||||
|
|
Loading…
Reference in a new issue