mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
avistaztracker: add search freeleech only setting (#13536)
Prowlarr/Prowlarr#1108
This commit is contained in:
@@ -7,7 +7,7 @@ using System.Net;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jackett.Common.Models;
|
using Jackett.Common.Models;
|
||||||
using Jackett.Common.Models.IndexerConfig;
|
using Jackett.Common.Models.IndexerConfig.Bespoke;
|
||||||
using Jackett.Common.Services.Interfaces;
|
using Jackett.Common.Services.Interfaces;
|
||||||
using Jackett.Common.Utils;
|
using Jackett.Common.Utils;
|
||||||
using Jackett.Common.Utils.Clients;
|
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 readonly HashSet<string> _hdResolutions = new HashSet<string> { "1080p", "1080i", "720p" };
|
||||||
private string _token;
|
private string _token;
|
||||||
|
|
||||||
private new ConfigurationDataBasicLoginWithPID configData => (ConfigurationDataBasicLoginWithPID)base.configData;
|
private new ConfigurationDataAvistazTracker configData => (ConfigurationDataAvistazTracker)base.configData;
|
||||||
|
|
||||||
// hook to adjust the search term
|
// hook to adjust the search term
|
||||||
protected virtual string GetSearchTerm(TorznabQuery query) => $"{query.SearchTerm} {query.GetEpisodeSearchString()}";
|
protected virtual string GetSearchTerm(TorznabQuery query) => $"{query.SearchTerm} {query.GetEpisodeSearchString()}";
|
||||||
@@ -72,6 +72,9 @@ namespace Jackett.Common.Indexers.Abstract
|
|||||||
if (!string.IsNullOrWhiteSpace(query.Genre))
|
if (!string.IsNullOrWhiteSpace(query.Genre))
|
||||||
qc.Add("tags", query.Genre);
|
qc.Add("tags", query.Genre);
|
||||||
|
|
||||||
|
if (configData.Freeleech.Value)
|
||||||
|
qc.Add("discount[]", "1");
|
||||||
|
|
||||||
return qc;
|
return qc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,8 +123,7 @@ namespace Jackett.Common.Indexers.Abstract
|
|||||||
logger: logger,
|
logger: logger,
|
||||||
p: p,
|
p: p,
|
||||||
cacheService: cs,
|
cacheService: cs,
|
||||||
configData: new ConfigurationDataBasicLoginWithPID(@"You have to check 'Enable RSS Feed' in 'My Account',
|
configData: new ConfigurationDataAvistazTracker())
|
||||||
without this configuration the torrent download does not work.<br/>You can find the PID in 'My profile'."))
|
|
||||||
{
|
{
|
||||||
Encoding = Encoding.UTF8;
|
Encoding = Encoding.UTF8;
|
||||||
Language = "en-US";
|
Language = "en-US";
|
||||||
|
@@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Jackett.Common.Indexers.Abstract;
|
using Jackett.Common.Indexers.Abstract;
|
||||||
using Jackett.Common.Models;
|
using Jackett.Common.Models;
|
||||||
|
using Jackett.Common.Models.IndexerConfig.Bespoke;
|
||||||
using Jackett.Common.Services.Interfaces;
|
using Jackett.Common.Services.Interfaces;
|
||||||
using Jackett.Common.Utils;
|
using Jackett.Common.Utils;
|
||||||
using Jackett.Common.Utils.Clients;
|
using Jackett.Common.Utils.Clients;
|
||||||
@@ -14,6 +15,8 @@ namespace Jackett.Common.Indexers
|
|||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class ExoticaZ : AvistazTracker
|
public class ExoticaZ : AvistazTracker
|
||||||
{
|
{
|
||||||
|
private new ConfigurationDataAvistazTracker configData => (ConfigurationDataAvistazTracker)base.configData;
|
||||||
|
|
||||||
public override string[] LegacySiteLinks { get; protected set; } =
|
public override string[] LegacySiteLinks { get; protected set; } =
|
||||||
{
|
{
|
||||||
"https://torrents.yourexotic.com/"
|
"https://torrents.yourexotic.com/"
|
||||||
@@ -53,6 +56,9 @@ namespace Jackett.Common.Indexers
|
|||||||
{"search", GetSearchTerm(query).Trim()}
|
{"search", GetSearchTerm(query).Trim()}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (configData.Freeleech.Value)
|
||||||
|
qc.Add("discount[]", "1");
|
||||||
|
|
||||||
return qc;
|
return qc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user