From 231d43e1819c68fc3e23bee9b87bd21c893c32b2 Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 17 Mar 2021 22:05:46 -0400 Subject: [PATCH] Fixed: Map Correct categories for BTN and default to back to TV --- .../BroadcastheNet/BroadcastheNet.cs | 2 +- .../BroadcastheNet/BroadcastheNetParser.cs | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNet.cs b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNet.cs index 2868e5a43..31468ec2c 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNet.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNet.cs @@ -42,7 +42,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet public override IParseIndexerResponse GetParser() { - return new BroadcastheNetParser(); + return new BroadcastheNetParser(Capabilities.Categories); } private IndexerCapabilities SetCapabilities() diff --git a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetParser.cs b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetParser.cs index 94ed45477..741c86cbf 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetParser.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Net; using System.Text.RegularExpressions; using NzbDrone.Common.Http; @@ -14,6 +15,13 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet public Action, DateTime?> CookiesUpdater { get; set; } + private readonly IndexerCapabilitiesCategories _categories; + + public BroadcastheNetParser(IndexerCapabilitiesCategories categories) + { + _categories = categories; + } + public IList ParseResponse(IndexerResponse indexerResponse) { var results = new List(); @@ -92,7 +100,17 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet torrentInfo.Container = torrent.Container; torrentInfo.Codec = torrent.Codec; torrentInfo.Resolution = torrent.Resolution; - torrentInfo.Category = new List { NewznabStandardCategory.TV }; + torrentInfo.UploadVolumeFactor = 1; + torrentInfo.DownloadVolumeFactor = 0; + torrentInfo.MinimumRatio = 1; + + torrentInfo.Category = _categories.MapTrackerCatToNewznab(torrent.Resolution); + + // Default to TV if category could not be mapped + if (torrentInfo.Category == null || !torrentInfo.Category.Any()) + { + torrentInfo.Category = new List { NewznabStandardCategory.TV }; + } results.Add(torrentInfo); }