avistaztracker: add search freeleech only setting (#13536)

Prowlarr/Prowlarr#1108
This commit is contained in:
ilike2burnthing
2022-09-11 01:30:05 +01:00
committed by GitHub
parent 927431fba2
commit 8a3625177e
3 changed files with 28 additions and 4 deletions

View File

@@ -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<string> _hdResolutions = new HashSet<string> { "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.<br/>You can find the PID in 'My profile'."))
configData: new ConfigurationDataAvistazTracker())
{
Encoding = Encoding.UTF8;
Language = "en-US";

View File

@@ -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;
}

View File

@@ -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.<br/>You can find the PID in 'My profile'.")
{
Freeleech = new BoolConfigurationItem("Search freeleech only") { Value = false };
}
}
}