mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-23 22:45:06 -04:00
Fixed: Indexer sort is case sensitive
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user