From 4188510586702f40574cdaaa010710c9e047073f Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 22 Jun 2024 04:18:28 +0300 Subject: [PATCH] New: (Cardigann) Add `info_category_8000` --- .../Indexers/Definitions/Cardigann/CardigannBase.cs | 1 + src/Prowlarr.Api.V1/Indexers/IndexerResource.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs index 2f8323079..6abdd710e 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs @@ -333,6 +333,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann case "info_cookie": case "info_flaresolverr": case "info_useragent": + case "info_category_8000": case "cardigannCaptcha": // no-op break; diff --git a/src/Prowlarr.Api.V1/Indexers/IndexerResource.cs b/src/Prowlarr.Api.V1/Indexers/IndexerResource.cs index 2f562cd3a..3dc9a2979 100644 --- a/src/Prowlarr.Api.V1/Indexers/IndexerResource.cs +++ b/src/Prowlarr.Api.V1/Indexers/IndexerResource.cs @@ -60,7 +60,7 @@ namespace Prowlarr.Api.V1.Indexers if (definition.Implementation == nameof(Cardigann)) { - var extraFields = definition.ExtraFields?.Select(MapCardigannField).ToList() ?? new List(); + var extraFields = definition.ExtraFields?.Select((field, i) => MapCardigannField(definition, field, i)).ToList() ?? new List(); resource.Fields.AddRange(extraFields); @@ -160,7 +160,7 @@ namespace Prowlarr.Api.V1.Indexers }; } - private Field MapCardigannField(SettingsField setting, int order) + private Field MapCardigannField(IndexerDefinition definition, SettingsField setting, int order) { var field = new Field { @@ -185,7 +185,7 @@ namespace Prowlarr.Api.V1.Indexers { field.Value = bool.TryParse(setting.Default, out var value) && value; } - else if (setting.Type is "info_cookie" or "info_flaresolverr" or "info_useragent") + else if (setting.Type is "info_cookie" or "info_flaresolverr" or "info_useragent" or "info_category_8000") { field.Type = "info"; @@ -203,6 +203,10 @@ namespace Prowlarr.Api.V1.Indexers field.Label = "How to get the User-Agent"; field.Value = "
  1. From the same place you fetched the cookie,
  2. Find 'user-agent:' in the Request Headers section
  3. Select and Copy the whole user-agent string (everything after 'user-agent: ') and Paste here.
"; break; + case "info_category_8000": + field.Label = $"About {definition.Name} Categories"; + field.Value = $"{definition.Name} does not return categories in its search results. To sync to your apps, include 8000(Other) in your Apps' Sync Categories."; + break; } } else