libble: add freeleech search. #9456

This commit is contained in:
Garfield69
2023-03-29 19:52:06 +13:00
parent 307412a64e
commit 10e4d8b0e3

View File

@@ -8,6 +8,7 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using AngleSharp.Html.Parser; using AngleSharp.Html.Parser;
using Autofac.Core;
using Jackett.Common.Extensions; using Jackett.Common.Extensions;
using Jackett.Common.Models; using Jackett.Common.Models;
using Jackett.Common.Models.IndexerConfig; using Jackett.Common.Models.IndexerConfig;
@@ -16,6 +17,7 @@ using Jackett.Common.Utils;
using Jackett.Common.Utils.Clients; using Jackett.Common.Utils.Clients;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using NLog; using NLog;
using static Jackett.Common.Models.IndexerConfig.ConfigurationData;
namespace Jackett.Common.Indexers namespace Jackett.Common.Indexers
{ {
@@ -76,6 +78,7 @@ namespace Jackett.Common.Indexers
cacheService: cs, cacheService: cs,
configData: new ConfigurationDataBasicLoginWith2FA()) configData: new ConfigurationDataBasicLoginWith2FA())
{ {
configData.AddDynamic("freeleech", new BoolConfigurationItem("Search freeleech only") { Value = false });
} }
private TorznabCapabilities SetCapabilities() private TorznabCapabilities SetCapabilities()
@@ -141,6 +144,9 @@ namespace Jackett.Common.Indexers
{ "order_way", "desc" } { "order_way", "desc" }
}; };
if (((BoolConfigurationItem)configData.GetDynamic("freeleech")).Value)
queryCollection.Set("freetorrent", "1");
// Search String // Search String
if (!string.IsNullOrWhiteSpace(query.ImdbID)) if (!string.IsNullOrWhiteSpace(query.ImdbID))
queryCollection.Set("cataloguenumber", query.ImdbID); queryCollection.Set("cataloguenumber", query.ImdbID);