mirror of
https://github.com/Readarr/Readarr
synced 2026-05-08 12:42:51 +02:00
Fixed: Cleaning percent signs from release names
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
9af59bddfe
commit
c4fd06949b
2 changed files with 12 additions and 0 deletions
|
|
@ -134,5 +134,13 @@ public void should_not_clean_trailing_a()
|
||||||
{
|
{
|
||||||
"Tokyo Ghoul A".CleanArtistName().Should().Be("tokyoghoula");
|
"Tokyo Ghoul A".CleanArtistName().Should().Be("tokyoghoula");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("3%", "3percent")]
|
||||||
|
[TestCase("Teen Top & 100% Outing Brothers", "teentop100percentoutingbrothers")]
|
||||||
|
[TestCase("Big Jay Oakerson's What's Your F@%king Deal?!", "bigjayoakersonswhatsyourfkingdeal")]
|
||||||
|
public void should_replace_percent_sign_with_percent_following_numbers(string input, string expected)
|
||||||
|
{
|
||||||
|
input.CleanArtistName().Should().Be(expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,8 @@ public static class Parser
|
||||||
string.Empty,
|
string.Empty,
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
|
private static readonly Regex PercentRegex = new Regex(@"(?<=\b\d+)%", RegexOptions.Compiled);
|
||||||
|
|
||||||
private static readonly Regex FileExtensionRegex = new Regex(@"\.[a-z0-9]{2,4}$",
|
private static readonly Regex FileExtensionRegex = new Regex(@"\.[a-z0-9]{2,4}$",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
|
|
@ -479,6 +481,8 @@ public static string CleanArtistName(this string name)
|
||||||
if (long.TryParse(name, out number))
|
if (long.TryParse(name, out number))
|
||||||
return name;
|
return name;
|
||||||
|
|
||||||
|
name = PercentRegex.Replace(name, "percent");
|
||||||
|
|
||||||
return NormalizeRegex.Replace(name).ToLower().RemoveAccent();
|
return NormalizeRegex.Replace(name).ToLower().RemoveAccent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue