torrentleech: add freeleech only option #9456 #10280 (#10298)

This commit is contained in:
Diego Heras
2020-11-25 19:16:36 +01:00
committed by GitHub
parent 79ca5b2f73
commit 4967fe4f60

View File

@@ -14,6 +14,7 @@ using Jackett.Common.Utils;
using Newtonsoft.Json; using Newtonsoft.Json;
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
{ {
@@ -64,6 +65,8 @@ namespace Jackett.Common.Indexers
Language = "en-us"; Language = "en-us";
Type = "private"; Type = "private";
configData.AddDynamic("freeleech", new BoolItem { Name = "Search freeleech only", Value = false });
AddCategoryMapping(1, TorznabCatType.Movies, "Movies"); AddCategoryMapping(1, TorznabCatType.Movies, "Movies");
AddCategoryMapping(8, TorznabCatType.MoviesSD, "Movies Cam"); AddCategoryMapping(8, TorznabCatType.MoviesSD, "Movies Cam");
AddCategoryMapping(9, TorznabCatType.MoviesSD, "Movies TS/TC"); AddCategoryMapping(9, TorznabCatType.MoviesSD, "Movies TS/TC");
@@ -151,6 +154,10 @@ namespace Jackett.Common.Indexers
searchString = Regex.Replace(searchString, @"(^|\s)-", " "); searchString = Regex.Replace(searchString, @"(^|\s)-", " ");
var searchUrl = SearchUrl; var searchUrl = SearchUrl;
if (((BoolItem) configData.GetDynamic("freeleech")).Value)
searchUrl += "facets/tags%3AFREELEECH/";
if (query.IsImdbQuery) if (query.IsImdbQuery)
searchUrl += "imdbID/" + query.ImdbID + "/"; searchUrl += "imdbID/" + query.ImdbID + "/";
else if (!string.IsNullOrWhiteSpace(searchString)) else if (!string.IsNullOrWhiteSpace(searchString))