Fixed: Indexer sort is case sensitive

This commit is contained in:
Qstick
2021-06-01 21:56:35 -04:00
parent e999b869a6
commit 56850aa6d9
7 changed files with 27 additions and 7 deletions
+17
View File
@@ -15,6 +15,12 @@ namespace NzbDrone.Core.Parser
{
public static class StringUtil
{
private static readonly Regex WordDelimiterRegex = new Regex(@"(\s|\.|,|_|-|=|'|\|)+", RegexOptions.Compiled);
private static readonly Regex SpecialCharRegex = new Regex(@"(\&|\:|\\|\/)+", RegexOptions.Compiled);
private static readonly Regex PunctuationRegex = new Regex(@"[^\w\s]", RegexOptions.Compiled);
private static readonly Regex CommonWordRegex = new Regex(@"\b(a|an|the|and|or|of)\b\s?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex DuplicateSpacesRegex = new Regex(@"\s{2,}", RegexOptions.Compiled);
public static string CleanFileName(string name, bool replace = true)
{
string result = name;
@@ -248,5 +254,16 @@ namespace NzbDrone.Core.Parser
return key;
}
}
public static string NormalizeTitle(this string title)
{
title = WordDelimiterRegex.Replace(title, " ");
title = PunctuationRegex.Replace(title, string.Empty);
title = CommonWordRegex.Replace(title, string.Empty);
title = DuplicateSpacesRegex.Replace(title, " ");
title = SpecialCharRegex.Replace(title, string.Empty);
return title.Trim().ToLower();
}
}
}