From 69d31f96de1ac0626656958682cd0de07687452e Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:54:28 -0600 Subject: [PATCH] New: (Cardigann) - Cardigann v4 Add Support for MapTrackerCatDescToNewznab --- .../Definitions/Cardigann/CardigannBase.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs index 0bd470522..0976a9087 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs @@ -375,6 +375,22 @@ namespace NzbDrone.Core.Indexers.Cardigann return results; } + public ICollection MapTrackerCatDescToNewznab(string trackerCategoryDesc) + { + if (string.IsNullOrWhiteSpace(trackerCategoryDesc)) + { + return new List(); + } + + var cats = _categoryMapping + .Where(m => + !string.IsNullOrWhiteSpace(m.TrackerCategoryDesc) && + string.Equals(m.TrackerCategoryDesc, trackerCategoryDesc, StringComparison.InvariantCultureIgnoreCase)) + .Select(c => NewznabStandardCategory.AllCats.FirstOrDefault(n => n.Id == c.NewzNabCategory) ?? new IndexerCategory { Id = c.NewzNabCategory }) + .ToList(); + return cats; + } + protected delegate string TemplateTextModifier(string str); protected string ApplyGoTemplateText(string template, Dictionary variables = null, TemplateTextModifier modifier = null)