From 9227efdb6577c3cdf4d3744f50ef9a1273c4d05c Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 17 Dec 2022 23:34:08 -0600 Subject: [PATCH] New: (FileList) Freeleech Only option Fixes #1147 --- .../Definitions/FileList/FileListRequestGenerator.cs | 5 +++++ .../Indexers/Definitions/FileList/FileListSettings.cs | 3 +++ .../Indexers/Settings/CookieTorrentBaseSettings.cs | 4 ++-- .../Indexers/Settings/NoAuthTorrentBaseSettings.cs | 4 ++-- .../Indexers/Settings/UserPassTorrentBaseSettings.cs | 4 ++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs index 226903005..803b7be39 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs @@ -109,6 +109,11 @@ namespace NzbDrone.Core.Indexers.FileList var baseUrl = string.Format("{0}/api.php?action={1}&category={2}&username={3}&passkey={4}{5}", Settings.BaseUrl.TrimEnd('/'), searchType, categoriesQuery, Settings.Username.Trim(), Settings.Passkey.Trim(), parameters); + if (Settings.FreeleechOnly) + { + baseUrl += "&freeleech=1"; + } + yield return new IndexerRequest(baseUrl, HttpAccept.Json); } } diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListSettings.cs index ec8e9c4bd..89934c9ea 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListSettings.cs @@ -29,6 +29,9 @@ namespace NzbDrone.Core.Indexers.FileList [FieldDefinition(3, Label = "Passkey", HelpText = "Site Passkey (This is the alphanumeric string in the tracker url shown in your download client)", Privacy = PrivacyLevel.Password, Type = FieldType.Password)] public string Passkey { get; set; } + [FieldDefinition(4, Label = "Freeleech Only", HelpText = "Search Freeleech torrents only", Type = FieldType.Checkbox)] + public bool FreeleechOnly { get; set; } + public override NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this)); diff --git a/src/NzbDrone.Core/Indexers/Settings/CookieTorrentBaseSettings.cs b/src/NzbDrone.Core/Indexers/Settings/CookieTorrentBaseSettings.cs index 1ea233525..b337c5339 100644 --- a/src/NzbDrone.Core/Indexers/Settings/CookieTorrentBaseSettings.cs +++ b/src/NzbDrone.Core/Indexers/Settings/CookieTorrentBaseSettings.cs @@ -27,10 +27,10 @@ namespace NzbDrone.Core.Indexers.Settings [FieldDefinition(2, Label = "Cookie", HelpText = "Site Cookie", Privacy = PrivacyLevel.Password, Type = FieldType.Password)] public string Cookie { get; set; } - [FieldDefinition(3)] + [FieldDefinition(10)] public IndexerBaseSettings BaseSettings { get; set; } = new IndexerBaseSettings(); - [FieldDefinition(4)] + [FieldDefinition(11)] public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new IndexerTorrentBaseSettings(); public virtual NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Settings/NoAuthTorrentBaseSettings.cs b/src/NzbDrone.Core/Indexers/Settings/NoAuthTorrentBaseSettings.cs index 9aff60db1..c2922551a 100644 --- a/src/NzbDrone.Core/Indexers/Settings/NoAuthTorrentBaseSettings.cs +++ b/src/NzbDrone.Core/Indexers/Settings/NoAuthTorrentBaseSettings.cs @@ -15,10 +15,10 @@ namespace NzbDrone.Core.Indexers.Settings [FieldDefinition(1, Label = "Base Url", Type = FieldType.Select, SelectOptionsProviderAction = "getUrls", HelpText = "Select which baseurl Prowlarr will use for requests to the site")] public string BaseUrl { get; set; } - [FieldDefinition(2)] + [FieldDefinition(10)] public IndexerBaseSettings BaseSettings { get; set; } = new IndexerBaseSettings(); - [FieldDefinition(3)] + [FieldDefinition(11)] public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new IndexerTorrentBaseSettings(); public virtual NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Settings/UserPassTorrentBaseSettings.cs b/src/NzbDrone.Core/Indexers/Settings/UserPassTorrentBaseSettings.cs index 7b03f66ee..07ef1f193 100644 --- a/src/NzbDrone.Core/Indexers/Settings/UserPassTorrentBaseSettings.cs +++ b/src/NzbDrone.Core/Indexers/Settings/UserPassTorrentBaseSettings.cs @@ -32,10 +32,10 @@ namespace NzbDrone.Core.Indexers.Settings [FieldDefinition(3, Label = "Password", HelpText = "Site Password", Privacy = PrivacyLevel.Password, Type = FieldType.Password)] public string Password { get; set; } - [FieldDefinition(4)] + [FieldDefinition(10)] public IndexerBaseSettings BaseSettings { get; set; } = new IndexerBaseSettings(); - [FieldDefinition(5)] + [FieldDefinition(11)] public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new IndexerTorrentBaseSettings(); public NzbDroneValidationResult Validate()