Improve music and console search results for AnimeBytes

Also prevent duplicate categories showing in the indexer info modal
This commit is contained in:
Bogdan
2023-08-21 18:08:43 +03:00
parent 9fee4f914f
commit 5ad6237785
2 changed files with 20 additions and 18 deletions

View File

@@ -1,3 +1,4 @@
import { uniqBy } from 'lodash';
import React, { useCallback, useState } from 'react'; import React, { useCallback, useState } from 'react';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
@@ -249,8 +250,7 @@ function IndexerInfoModalContent(props: IndexerInfoModalContentProps) {
</div> </div>
</FieldSet> </FieldSet>
{capabilities.categories !== null && {capabilities?.categories?.length > 0 ? (
capabilities.categories.length > 0 ? (
<FieldSet legend={translate('IndexerCategories')}> <FieldSet legend={translate('IndexerCategories')}>
<Table <Table
columns={[ columns={[
@@ -266,7 +266,7 @@ function IndexerInfoModalContent(props: IndexerInfoModalContentProps) {
}, },
]} ]}
> >
{capabilities.categories {uniqBy(capabilities.categories, 'id')
.sort((a, b) => a.id - b.id) .sort((a, b) => a.id - b.id)
.map((category) => { .map((category) => {
return ( return (
@@ -275,9 +275,8 @@ function IndexerInfoModalContent(props: IndexerInfoModalContentProps) {
<TableRowCell>{category.id}</TableRowCell> <TableRowCell>{category.id}</TableRowCell>
<TableRowCell>{category.name}</TableRowCell> <TableRowCell>{category.name}</TableRowCell>
</TableRow> </TableRow>
{category.subCategories !== null && {category?.subCategories?.length > 0
category.subCategories.length > 0 ? uniqBy(category.subCategories, 'id')
? category.subCategories
.sort((a, b) => a.id - b.id) .sort((a, b) => a.id - b.id)
.map((subCategory) => { .map((subCategory) => {
return ( return (

View File

@@ -124,7 +124,9 @@ namespace NzbDrone.Core.Indexers.Definitions
caps.Categories.AddCategoryMapping("anime[bd_special]", NewznabStandardCategory.TVAnime, "BD Special"); caps.Categories.AddCategoryMapping("anime[bd_special]", NewznabStandardCategory.TVAnime, "BD Special");
caps.Categories.AddCategoryMapping("anime[movie]", NewznabStandardCategory.Movies, "Movie"); caps.Categories.AddCategoryMapping("anime[movie]", NewznabStandardCategory.Movies, "Movie");
caps.Categories.AddCategoryMapping("audio", NewznabStandardCategory.Audio, "Music"); caps.Categories.AddCategoryMapping("audio", NewznabStandardCategory.Audio, "Music");
caps.Categories.AddCategoryMapping("gamec[game]", NewznabStandardCategory.Console, "Game");
caps.Categories.AddCategoryMapping("gamec[game]", NewznabStandardCategory.PCGames, "Game"); caps.Categories.AddCategoryMapping("gamec[game]", NewznabStandardCategory.PCGames, "Game");
caps.Categories.AddCategoryMapping("gamec[visual_novel]", NewznabStandardCategory.Console, "Game Visual Novel");
caps.Categories.AddCategoryMapping("gamec[visual_novel]", NewznabStandardCategory.PCGames, "Game Visual Novel"); caps.Categories.AddCategoryMapping("gamec[visual_novel]", NewznabStandardCategory.PCGames, "Game Visual Novel");
caps.Categories.AddCategoryMapping("printedtype[manga]", NewznabStandardCategory.BooksComics, "Manga"); caps.Categories.AddCategoryMapping("printedtype[manga]", NewznabStandardCategory.BooksComics, "Manga");
caps.Categories.AddCategoryMapping("printedtype[oneshot]", NewznabStandardCategory.BooksComics, "Oneshot"); caps.Categories.AddCategoryMapping("printedtype[oneshot]", NewznabStandardCategory.BooksComics, "Oneshot");
@@ -364,7 +366,7 @@ namespace NzbDrone.Core.Indexers.Definitions
var minimumSeedTime = 259200 + (int)(size / (int)Math.Pow(1024, 3) * 18000); var minimumSeedTime = 259200 + (int)(size / (int)Math.Pow(1024, 3) * 18000);
var propertyList = WebUtility.HtmlDecode(torrent.Property) var propertyList = WebUtility.HtmlDecode(torrent.Property)
.Split('|', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) .Split(new[] { " | ", " / " }, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries)
.ToList(); .ToList();
propertyList.RemoveAll(p => ExcludedProperties.Any(p.ContainsIgnoreCase)); propertyList.RemoveAll(p => ExcludedProperties.Any(p.ContainsIgnoreCase));
@@ -386,7 +388,6 @@ namespace NzbDrone.Core.Indexers.Definitions
} }
if (_settings.ExcludeRaw && if (_settings.ExcludeRaw &&
categoryName == "Anime" &&
properties.Any(p => p.StartsWithIgnoreCase("RAW") || p.Contains("BR-DISK"))) properties.Any(p => p.StartsWithIgnoreCase("RAW") || p.Contains("BR-DISK")))
{ {
continue; continue;
@@ -467,32 +468,34 @@ namespace NzbDrone.Core.Indexers.Definitions
{ {
if (properties.Contains("PSP")) if (properties.Contains("PSP"))
{ {
categories = new List<IndexerCategory> { NewznabStandardCategory.ConsolePSP }; categories = new List<IndexerCategory> { NewznabStandardCategory.Console, NewznabStandardCategory.ConsolePSP };
} }
if (properties.Contains("PS3")) if (properties.Contains("PS3"))
{ {
categories = new List<IndexerCategory> { NewznabStandardCategory.ConsolePS3 }; categories = new List<IndexerCategory> { NewznabStandardCategory.Console, NewznabStandardCategory.ConsolePS3 };
} }
if (properties.Contains("PS Vita")) if (properties.Contains("PS Vita"))
{ {
categories = new List<IndexerCategory> { NewznabStandardCategory.ConsolePSVita }; categories = new List<IndexerCategory> { NewznabStandardCategory.Console, NewznabStandardCategory.ConsolePSVita };
} }
if (properties.Contains("3DS")) if (properties.Contains("3DS"))
{ {
categories = new List<IndexerCategory> { NewznabStandardCategory.Console3DS }; categories = new List<IndexerCategory> { NewznabStandardCategory.Console, NewznabStandardCategory.Console3DS };
} }
if (properties.Contains("NDS")) if (properties.Contains("NDS"))
{ {
categories = new List<IndexerCategory> { NewznabStandardCategory.ConsoleNDS }; categories = new List<IndexerCategory> { NewznabStandardCategory.Console, NewznabStandardCategory.ConsoleNDS };
} }
if (properties.Contains("PSX") || properties.Contains("PS2") || properties.Contains("SNES") || properties.Contains("NES") || properties.Contains("GBA") || properties.Contains("Switch")) if (properties.Contains("PSX") || properties.Contains("PS2") || properties.Contains("SNES") ||
properties.Contains("NES") || properties.Contains("GBA") || properties.Contains("Switch") ||
properties.Contains("N64"))
{ {
categories = new List<IndexerCategory> { NewznabStandardCategory.ConsoleOther }; categories = new List<IndexerCategory> { NewznabStandardCategory.Console, NewznabStandardCategory.ConsoleOther };
} }
if (properties.Contains("PC")) if (properties.Contains("PC"))
@@ -505,15 +508,15 @@ namespace NzbDrone.Core.Indexers.Definitions
{ {
if (properties.Any(p => p.Contains("Lossless"))) if (properties.Any(p => p.Contains("Lossless")))
{ {
categories = new List<IndexerCategory> { NewznabStandardCategory.AudioLossless }; categories = new List<IndexerCategory> { NewznabStandardCategory.Audio, NewznabStandardCategory.AudioLossless };
} }
else if (properties.Any(p => p.Contains("MP3"))) else if (properties.Any(p => p.Contains("MP3")))
{ {
categories = new List<IndexerCategory> { NewznabStandardCategory.AudioMP3 }; categories = new List<IndexerCategory> { NewznabStandardCategory.Audio, NewznabStandardCategory.AudioMP3 };
} }
else else
{ {
categories = new List<IndexerCategory> { NewznabStandardCategory.AudioOther }; categories = new List<IndexerCategory> { NewznabStandardCategory.Audio, NewznabStandardCategory.AudioOther };
} }
} }