From ed0e69de53f67ab09478f168c47b2b4c6114c647 Mon Sep 17 00:00:00 2001 From: Qstick Date: Fri, 5 Jul 2019 16:01:07 -0400 Subject: [PATCH] Fixed: Return all movie categories for RARBG Co-Authored-By: FuNK3Y --- .../Indexers/Rarbg/RarbgRequestGenerator.cs | 9 +++++++-- src/NzbDrone.Core/Indexers/Rarbg/RarbgSettings.cs | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Rarbg/RarbgRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Rarbg/RarbgRequestGenerator.cs index 53c790e4d..2df0b3825 100644 --- a/src/NzbDrone.Core/Indexers/Rarbg/RarbgRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Rarbg/RarbgRequestGenerator.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.IndexerSearch.Definitions; @@ -60,7 +61,9 @@ namespace NzbDrone.Core.Indexers.Rarbg requestBuilder.AddQueryParam("ranked", "0"); } - requestBuilder.AddQueryParam("category", "movies"); + var categoryParam = string.Join(";", Settings.Categories.Distinct()); + + requestBuilder.AddQueryParam("category", categoryParam); requestBuilder.AddQueryParam("limit", "100"); requestBuilder.AddQueryParam("token", _tokenProvider.GetToken(Settings)); requestBuilder.AddQueryParam("format", "json_extended"); @@ -98,7 +101,9 @@ namespace NzbDrone.Core.Indexers.Rarbg requestBuilder.AddQueryParam("ranked", "0"); } - requestBuilder.AddQueryParam("category", "movies"); + var categoryParam = string.Join(";", Settings.Categories.Distinct()); + + requestBuilder.AddQueryParam("category", categoryParam); requestBuilder.AddQueryParam("limit", "100"); requestBuilder.AddQueryParam("token", _tokenProvider.GetToken(Settings)); requestBuilder.AddQueryParam("format", "json_extended"); diff --git a/src/NzbDrone.Core/Indexers/Rarbg/RarbgSettings.cs b/src/NzbDrone.Core/Indexers/Rarbg/RarbgSettings.cs index a86d5c5ac..38baf4b9c 100644 --- a/src/NzbDrone.Core/Indexers/Rarbg/RarbgSettings.cs +++ b/src/NzbDrone.Core/Indexers/Rarbg/RarbgSettings.cs @@ -14,6 +14,8 @@ namespace NzbDrone.Core.Indexers.Rarbg { RuleFor(c => c.BaseUrl).ValidRootUrl(); + RuleFor(c => c.Categories).NotEmpty(); + RuleFor(c => c.SeedCriteria).SetValidator(_ => new SeedCriteriaSettingsValidator()); } } @@ -27,6 +29,7 @@ namespace NzbDrone.Core.Indexers.Rarbg BaseUrl = "https://torrentapi.org"; RankedOnly = false; MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS; + Categories = new[] { 14, 48, 17, 44, 45, 47, 50, 51, 52, 42, 46 }; MultiLanguages = Enumerable.Empty(); } @@ -48,7 +51,10 @@ namespace NzbDrone.Core.Indexers.Rarbg [FieldDefinition(5, Type = FieldType.Tag, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Radarr/Radarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)] public IEnumerable RequiredFlags { get; set; } - [FieldDefinition(6)] + [FieldDefinition(6, Type = FieldType.Textbox, Label = "Categories", HelpText = "Comma Separated list, you can retrieve the ID by checking the URL behind the category on the website (i.e. Movie/x264/1080 = 44)", HelpLink = "https://rarbgmirror.org/torrents.php?category=movies", Advanced = true)] + public IEnumerable Categories { get; set; } + + [FieldDefinition(7)] public SeedCriteriaSettings SeedCriteria { get; } = new SeedCriteriaSettings(); public NzbDroneValidationResult Validate()