From 8a3625177e40f7fbb9906deea46510514a7db312 Mon Sep 17 00:00:00 2001 From: ilike2burnthing <59480337+ilike2burnthing@users.noreply.github.com> Date: Sun, 11 Sep 2022 01:30:05 +0100 Subject: [PATCH] avistaztracker: add search freeleech only setting (#13536) Prowlarr/Prowlarr#1108 --- .../Indexers/Abstract/AvistazTracker.cs | 10 ++++++---- src/Jackett.Common/Indexers/ExoticaZ.cs | 6 ++++++ .../Bespoke/ConfigurationDataAvistazTracker.cs | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataAvistazTracker.cs diff --git a/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs b/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs index 320ff0320..45fe990aa 100644 --- a/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs @@ -7,7 +7,7 @@ using System.Net; using System.Text; using System.Threading.Tasks; using Jackett.Common.Models; -using Jackett.Common.Models.IndexerConfig; +using Jackett.Common.Models.IndexerConfig.Bespoke; using Jackett.Common.Services.Interfaces; using Jackett.Common.Utils; using Jackett.Common.Utils.Clients; @@ -30,7 +30,7 @@ namespace Jackett.Common.Indexers.Abstract private readonly HashSet _hdResolutions = new HashSet { "1080p", "1080i", "720p" }; private string _token; - private new ConfigurationDataBasicLoginWithPID configData => (ConfigurationDataBasicLoginWithPID)base.configData; + private new ConfigurationDataAvistazTracker configData => (ConfigurationDataAvistazTracker)base.configData; // hook to adjust the search term protected virtual string GetSearchTerm(TorznabQuery query) => $"{query.SearchTerm} {query.GetEpisodeSearchString()}"; @@ -72,6 +72,9 @@ namespace Jackett.Common.Indexers.Abstract if (!string.IsNullOrWhiteSpace(query.Genre)) qc.Add("tags", query.Genre); + if (configData.Freeleech.Value) + qc.Add("discount[]", "1"); + return qc; } @@ -120,8 +123,7 @@ namespace Jackett.Common.Indexers.Abstract logger: logger, p: p, cacheService: cs, - configData: new ConfigurationDataBasicLoginWithPID(@"You have to check 'Enable RSS Feed' in 'My Account', -without this configuration the torrent download does not work.
You can find the PID in 'My profile'.")) + configData: new ConfigurationDataAvistazTracker()) { Encoding = Encoding.UTF8; Language = "en-US"; diff --git a/src/Jackett.Common/Indexers/ExoticaZ.cs b/src/Jackett.Common/Indexers/ExoticaZ.cs index 566894bce..eb4153aa2 100644 --- a/src/Jackett.Common/Indexers/ExoticaZ.cs +++ b/src/Jackett.Common/Indexers/ExoticaZ.cs @@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using Jackett.Common.Indexers.Abstract; using Jackett.Common.Models; +using Jackett.Common.Models.IndexerConfig.Bespoke; using Jackett.Common.Services.Interfaces; using Jackett.Common.Utils; using Jackett.Common.Utils.Clients; @@ -14,6 +15,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class ExoticaZ : AvistazTracker { + private new ConfigurationDataAvistazTracker configData => (ConfigurationDataAvistazTracker)base.configData; + public override string[] LegacySiteLinks { get; protected set; } = { "https://torrents.yourexotic.com/" @@ -53,6 +56,9 @@ namespace Jackett.Common.Indexers {"search", GetSearchTerm(query).Trim()} }; + if (configData.Freeleech.Value) + qc.Add("discount[]", "1"); + return qc; } diff --git a/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataAvistazTracker.cs b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataAvistazTracker.cs new file mode 100644 index 000000000..38b4435a4 --- /dev/null +++ b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataAvistazTracker.cs @@ -0,0 +1,16 @@ +using System.Diagnostics.CodeAnalysis; + +namespace Jackett.Common.Models.IndexerConfig.Bespoke +{ + [ExcludeFromCodeCoverage] + internal class ConfigurationDataAvistazTracker : ConfigurationDataBasicLoginWithPID + { + public BoolConfigurationItem Freeleech { get; private set; } + + public ConfigurationDataAvistazTracker() + : base("You have to check 'Enable RSS Feed' in 'My Account', without this configuration the torrent download does not work.
You can find the PID in 'My profile'.") + { + Freeleech = new BoolConfigurationItem("Search freeleech only") { Value = false }; + } + } +}