mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 05:47:22 -04:00
Fixed: Indexer sort is case sensitive
This commit is contained in:
parent
e999b869a6
commit
56850aa6d9
7 changed files with 27 additions and 7 deletions
|
@ -30,7 +30,7 @@ function IndexerIndexSortMenu(props) {
|
|||
</SortMenuItem>
|
||||
|
||||
<SortMenuItem
|
||||
name="name"
|
||||
name="sortName"
|
||||
sortKey={sortKey}
|
||||
sortDirection={sortDirection}
|
||||
onPress={onSortSelect}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
flex: 0 0 60px;
|
||||
}
|
||||
|
||||
.name {
|
||||
.sortName {
|
||||
composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css';
|
||||
|
||||
flex: 4 0 110px;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
flex: 0 0 60px;
|
||||
}
|
||||
|
||||
.name {
|
||||
.sortName {
|
||||
composes: cell;
|
||||
|
||||
flex: 4 0 110px;
|
||||
|
|
|
@ -136,7 +136,7 @@ class IndexerIndexRow extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
if (column.name === 'name') {
|
||||
if (column.name === 'sortName') {
|
||||
return (
|
||||
<VirtualTableRowCell
|
||||
key={column.name}
|
||||
|
|
|
@ -24,9 +24,9 @@ export const defaultState = {
|
|||
saveError: null,
|
||||
isDeleting: false,
|
||||
deleteError: null,
|
||||
sortKey: 'name',
|
||||
sortKey: 'sortName',
|
||||
sortDirection: sortDirections.ASCENDING,
|
||||
secondarySortKey: 'name',
|
||||
secondarySortKey: 'sortName',
|
||||
secondarySortDirection: sortDirections.ASCENDING,
|
||||
|
||||
tableOptions: {
|
||||
|
@ -50,7 +50,7 @@ export const defaultState = {
|
|||
isModifiable: false
|
||||
},
|
||||
{
|
||||
name: 'name',
|
||||
name: 'sortName',
|
||||
label: 'Indexer Name',
|
||||
isSortable: true,
|
||||
isVisible: true,
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using NzbDrone.Core.Annotations;
|
|||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.Cardigann;
|
||||
using NzbDrone.Core.IndexerVersions;
|
||||
using NzbDrone.Core.Parser;
|
||||
using Prowlarr.Http.ClientSchema;
|
||||
|
||||
namespace Prowlarr.Api.V1.Indexers
|
||||
|
@ -29,6 +30,7 @@ namespace Prowlarr.Api.V1.Indexers
|
|||
public int Priority { get; set; }
|
||||
public DateTime Added { get; set; }
|
||||
public IndexerStatusResource Status { get; set; }
|
||||
public string SortName { get; set; }
|
||||
}
|
||||
|
||||
public class IndexerResourceMapper : ProviderResourceMapper<IndexerResource, IndexerDefinition>
|
||||
|
@ -81,6 +83,7 @@ namespace Prowlarr.Api.V1.Indexers
|
|||
resource.Privacy = definition.Privacy;
|
||||
resource.Priority = definition.Priority;
|
||||
resource.Added = definition.Added;
|
||||
resource.SortName = definition.Name.NormalizeTitle();
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue