From a6d2283be8402f6bfc850a368b68324d1b2b2860 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Thu, 2 Apr 2015 19:52:23 +0200 Subject: [PATCH] New: Added Advanced option to Nyaa to change query parameters for category and filter. --- src/NzbDrone.Core/Indexers/Nyaa/NyaaRequestGenerator.cs | 2 +- src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Nyaa/NyaaRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Nyaa/NyaaRequestGenerator.cs index 9ec827c23..cb288955a 100644 --- a/src/NzbDrone.Core/Indexers/Nyaa/NyaaRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Nyaa/NyaaRequestGenerator.cs @@ -84,7 +84,7 @@ namespace NzbDrone.Core.Indexers.Nyaa private IEnumerable GetPagedRequests(Int32 maxPages, String searchParameters) { - var baseUrl = String.Format("{0}/?page=rss&cats=1_37&filter=1", Settings.BaseUrl.TrimEnd('/')); + var baseUrl = String.Format("{0}/?page=rss{1}", Settings.BaseUrl.TrimEnd('/'), Settings.AdditionalParameters); if (PageSize == 0) { diff --git a/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs b/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs index b080290e8..aeccd4963 100644 --- a/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs +++ b/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs @@ -3,7 +3,7 @@ using FluentValidation; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; - +using System.Text.RegularExpressions; namespace NzbDrone.Core.Indexers.Nyaa { public class NyaaSettingsValidator : AbstractValidator @@ -11,6 +11,7 @@ namespace NzbDrone.Core.Indexers.Nyaa public NyaaSettingsValidator() { RuleFor(c => c.BaseUrl).ValidRootUrl(); + RuleFor(c => c.AdditionalParameters).Matches("(&[a-z]+=[a-z0-9_]+)*", RegexOptions.IgnoreCase); } } @@ -21,11 +22,15 @@ namespace NzbDrone.Core.Indexers.Nyaa public NyaaSettings() { BaseUrl = "http://www.nyaa.se"; + AdditionalParameters = "&cats=1_37&filter=1"; } [FieldDefinition(0, Label = "Website URL")] public String BaseUrl { get; set; } + [FieldDefinition(1, Label = "Additional Parameters", Advanced = true, HelpText = "Please note if you change the category you will have to add required/restricted rules about the subgroups to avoid foreign language releases.")] + public String AdditionalParameters { get; set; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this));