diff --git a/README.md b/README.md index 80d839c9e..205afd660 100644 --- a/README.md +++ b/README.md @@ -676,7 +676,7 @@ Jackett is available as a beta package from [SynoCommunity](https://synocommunit ## Running Jackett behind a reverse proxy -When running jackett behind a reverse proxy make sure that the original hostname of the request is passed to Jackett. If HTTPS is used also set the X-Forwarded-Proto header to "https". Don't forget to adjust the "Base Path Override" Jackett option accordingly. +When running jackett behind a reverse proxy make sure that the original hostname of the request is passed to Jackett. If HTTPS is used also set the X-Forwarded-Proto header to "https". Don't forget to adjust the "Base path override" Jackett option accordingly. Example config for apache: ``` diff --git a/src/Jackett.Common/Content/custom.css b/src/Jackett.Common/Content/custom.css index 1d4895cde..5692e2a99 100644 --- a/src/Jackett.Common/Content/custom.css +++ b/src/Jackett.Common/Content/custom.css @@ -134,8 +134,8 @@ hr { } .input-header { - font-size: 18px; - width: 160px; + font-size: 16px; + width: 250px; display: inline-block; } @@ -165,7 +165,7 @@ hr { text-align: center; } -#jackett-allowext, #jackett-allowupdate, #jackett-logging, #jackett-prerelease { +#jackett-allowext, #jackett-allowupdate, #jackett-logging, #jackett-prerelease, #jackett-cache-enabled { width: 25px; } diff --git a/src/Jackett.Common/Content/custom.js b/src/Jackett.Common/Content/custom.js index f950241b8..f663ffed3 100644 --- a/src/Jackett.Common/Content/custom.js +++ b/src/Jackett.Common/Content/custom.js @@ -98,6 +98,14 @@ function loadJackettSettings() { $("#jackett-allowupdate").attr('checked', data.updatedisabled); $("#jackett-prerelease").attr('checked', data.prerelease); $("#jackett-logging").attr('checked', data.logging); + + $("#jackett-cache-enabled").attr('checked', data.cache_enabled); + $("#jackett-cache-ttl").val(data.cache_ttl); + $("#jackett-cache-max-results-per-indexer").val(data.cache_max_results_per_indexer); + if (!data.cache_enabled) { + $("#jackett-show-releases").attr("disabled", true); + } + $("#jackett-omdbkey").val(data.omdbkey); $("#jackett-omdburl").val(data.omdburl); var password = data.password; @@ -1126,6 +1134,9 @@ function bindUIButtons() { var jackett_update = $("#jackett-allowupdate").is(':checked'); var jackett_prerelease = $("#jackett-prerelease").is(':checked'); var jackett_logging = $("#jackett-logging").is(':checked'); + var jackett_cache_enabled = $("#jackett-cache-enabled").is(':checked'); + var jackett_cache_ttl = $("#jackett-cache-ttl").val(); + var jackett_cache_max_results_per_indexer = $("#jackett-cache-max-results-per-indexer").val(); var jackett_omdb_key = $("#jackett-omdbkey").val(); var jackett_omdb_url = $("#jackett-omdburl").val(); @@ -1143,6 +1154,10 @@ function bindUIButtons() { blackholedir: $("#jackett-savedir").val(), logging: jackett_logging, basepathoverride: jackett_basepathoverride, + logging: jackett_logging, + cache_enabled: jackett_cache_enabled, + cache_ttl: jackett_cache_ttl, + cache_max_results_per_indexer: jackett_cache_max_results_per_indexer, omdbkey: jackett_omdb_key, omdburl: jackett_omdb_url, proxy_type: jackett_proxy_type, diff --git a/src/Jackett.Common/Content/custom_mobile.css b/src/Jackett.Common/Content/custom_mobile.css index b950fd617..3c9fe822a 100644 --- a/src/Jackett.Common/Content/custom_mobile.css +++ b/src/Jackett.Common/Content/custom_mobile.css @@ -126,8 +126,8 @@ hr { } .input-header { - font-size: 18px; - width: 160px; + font-size: 16px; + width: 250px; display: inline-block; } @@ -157,7 +157,7 @@ hr { text-align: center; } -#jackett-allowext, #jackett-allowupdate, #jackett-logging, #jackett-prerelease { +#jackett-allowext, #jackett-allowupdate, #jackett-logging, #jackett-prerelease, #jackett-cache-enabled { width: 25px; } diff --git a/src/Jackett.Common/Content/index.html b/src/Jackett.Common/Content/index.html index 3730d2d96..cb1c89c1b 100644 --- a/src/Jackett.Common/Content/index.html +++ b/src/Jackett.Common/Content/index.html @@ -33,8 +33,8 @@ - - + + @@ -127,7 +127,7 @@
- Base Path Override: + Base path override:
@@ -135,7 +135,7 @@
- Manual download blackhole directory: + Blackhole directory:
@@ -188,6 +188,18 @@ Enhanced logging: +
+ Cache enabled (recommended): + +
+
+ Cache TTL (seconds): + +
+
+ Cache max results per indexer: + +
OMDB API key: @@ -680,6 +692,6 @@ - + diff --git a/src/Jackett.Common/Indexers/Abnormal.cs b/src/Jackett.Common/Indexers/Abnormal.cs index 0d9cd9944..13fdded66 100644 --- a/src/Jackett.Common/Indexers/Abnormal.cs +++ b/src/Jackett.Common/Indexers/Abnormal.cs @@ -49,7 +49,8 @@ namespace Jackett.Common.Indexers set => configData = value; } - public Abnormal(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public Abnormal(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "abnormal", name: "Abnormal", description: "General French Private Tracker", @@ -68,6 +69,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, downloadBase: "https://abnormal.ws/torrents.php?action=download&id=", configData: new ConfigurationDataAbnormal()) { diff --git a/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs b/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs index 698a920ab..7062ca852 100644 --- a/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/AvistazTracker.cs @@ -106,7 +106,7 @@ namespace Jackett.Common.Indexers.Abstract protected AvistazTracker(string link, string id, string name, string description, IIndexerConfigurationService configService, WebClient client, Logger logger, - IProtectionService p, TorznabCapabilities caps) + IProtectionService p, ICacheService cs, TorznabCapabilities caps) : base(id: id, name: name, description: description, @@ -116,6 +116,7 @@ namespace Jackett.Common.Indexers.Abstract client: client, 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'.")) { diff --git a/src/Jackett.Common/Indexers/Abstract/CouchPotatoTracker.cs b/src/Jackett.Common/Indexers/Abstract/CouchPotatoTracker.cs index aa97a6ec7..2582c4bf4 100644 --- a/src/Jackett.Common/Indexers/Abstract/CouchPotatoTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/CouchPotatoTracker.cs @@ -27,8 +27,8 @@ namespace Jackett.Common.Indexers.Abstract protected CouchPotatoTracker(string link, string id, string name, string description, IIndexerConfigurationService configService, WebClient client, Logger logger, - IProtectionService p, TorznabCapabilities caps, ConfigurationData configData, - string endpoint) + IProtectionService p, ICacheService cs, TorznabCapabilities caps, + ConfigurationData configData, string endpoint) : base(id: id, name: name, description: description, @@ -38,6 +38,7 @@ namespace Jackett.Common.Indexers.Abstract client: client, logger: logger, p: p, + cacheService: cs, configData: configData) { this.endpoint = endpoint; diff --git a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs index 00e36f672..4e38db1dc 100644 --- a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs @@ -37,9 +37,9 @@ namespace Jackett.Common.Indexers.Abstract protected GazelleTracker(string link, string id, string name, string description, IIndexerConfigurationService configService, WebClient client, Logger logger, - IProtectionService p, TorznabCapabilities caps, bool supportsFreeleechTokens, - bool imdbInTags = false, bool has2Fa = false, bool useApiKey = false, - string instructionMessageOptional = null) + IProtectionService p, ICacheService cs, TorznabCapabilities caps, + bool supportsFreeleechTokens, bool imdbInTags = false, bool has2Fa = false, + bool useApiKey = false, string instructionMessageOptional = null) : base(id: id, name: name, description: description, @@ -49,6 +49,7 @@ namespace Jackett.Common.Indexers.Abstract client: client, logger: logger, p: p, + cacheService: cs, configData: new ConfigurationDataGazelleTracker( has2Fa, supportsFreeleechTokens, useApiKey, instructionMessageOptional)) { diff --git a/src/Jackett.Common/Indexers/AlphaRatio.cs b/src/Jackett.Common/Indexers/AlphaRatio.cs index f6056de14..05523e43b 100644 --- a/src/Jackett.Common/Indexers/AlphaRatio.cs +++ b/src/Jackett.Common/Indexers/AlphaRatio.cs @@ -12,7 +12,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class AlphaRatio : GazelleTracker { - public AlphaRatio(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public AlphaRatio(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "alpharatio", name: "AlphaRatio", description: "AlphaRatio (AR) is a Private Torrent Tracker for 0DAY / GENERAL", @@ -32,6 +33,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cs: cs, supportsFreeleechTokens: true, imdbInTags: true) { diff --git a/src/Jackett.Common/Indexers/AniDUB.cs b/src/Jackett.Common/Indexers/AniDUB.cs index 1d4084f2e..7b35b7054 100644 --- a/src/Jackett.Common/Indexers/AniDUB.cs +++ b/src/Jackett.Common/Indexers/AniDUB.cs @@ -27,7 +27,8 @@ namespace Jackett.Common.Indexers private static readonly Regex SeasonInfoRegex = new Regex(@"(?:(?:TV-)|(?:ТВ-))(\d+)", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Lazy StripRussianTitleRegex = new Lazy(() => new Regex(@"^.*?\/\s*", RegexOptions.Compiled)); - public AniDUB(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public AniDUB(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "anidub", name: "AniDUB", description: "AniDUB Tracker is a semi-private russian tracker and release group for anime", @@ -51,6 +52,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataAniDub()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/AniLibria.cs b/src/Jackett.Common/Indexers/AniLibria.cs index d41e27f79..8988abebc 100644 --- a/src/Jackett.Common/Indexers/AniLibria.cs +++ b/src/Jackett.Common/Indexers/AniLibria.cs @@ -18,7 +18,7 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class AniLibria : BaseWebIndexer { - public AniLibria(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) + public AniLibria(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps, ICacheService cs) : base(id: "AniLibria", name: "AniLibria", description: "AniLibria is a Public torrent tracker for anime, voiced on russian by AniLibria team", @@ -34,6 +34,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataAniLibria()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/Anidex.cs b/src/Jackett.Common/Indexers/Anidex.cs index 960555f50..2f8d098d0 100644 --- a/src/Jackett.Common/Indexers/Anidex.cs +++ b/src/Jackett.Common/Indexers/Anidex.cs @@ -23,7 +23,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class Anidex : BaseWebIndexer { - public Anidex(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) + public Anidex(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "anidex", name: "Anidex", description: "Anidex is a Public torrent tracker and indexer, primarily for English fansub groups of anime", @@ -39,6 +40,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/AnimeBytes.cs b/src/Jackett.Common/Indexers/AnimeBytes.cs index 2da2cde8d..01d560b40 100644 --- a/src/Jackett.Common/Indexers/AnimeBytes.cs +++ b/src/Jackett.Common/Indexers/AnimeBytes.cs @@ -32,7 +32,8 @@ namespace Jackett.Common.Indexers private ConfigurationDataAnimeBytes ConfigData => (ConfigurationDataAnimeBytes)configData; - public AnimeBytes(IIndexerConfigurationService configService, WebClient client, Logger l, IProtectionService ps) + public AnimeBytes(IIndexerConfigurationService configService, WebClient client, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "animebytes", name: "AnimeBytes", description: "Powered by Tentacles", @@ -59,6 +60,7 @@ namespace Jackett.Common.Indexers }, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataAnimeBytes("Note: Go to AnimeBytes site and open your account settings. Go to 'Account' tab, move cursor over black part near 'Passkey' and copy its value. Your username is case sensitive.")) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/AnimeTorrents.cs b/src/Jackett.Common/Indexers/AnimeTorrents.cs index e71377a2c..940027479 100644 --- a/src/Jackett.Common/Indexers/AnimeTorrents.cs +++ b/src/Jackett.Common/Indexers/AnimeTorrents.cs @@ -32,7 +32,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public AnimeTorrents(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps) + public AnimeTorrents(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "animetorrents", name: "AnimeTorrents", description: "Definitive source for anime and manga", @@ -51,6 +52,7 @@ namespace Jackett.Common.Indexers client: c, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/Animedia.cs b/src/Jackett.Common/Indexers/Animedia.cs index d02e90bf0..b6f10827f 100644 --- a/src/Jackett.Common/Indexers/Animedia.cs +++ b/src/Jackett.Common/Indexers/Animedia.cs @@ -27,7 +27,8 @@ namespace Jackett.Common.Indexers private static readonly Regex SizeInfoQueryRegex = new Regex(@"Размер:(.*)\n", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex ReleaseDateInfoQueryRegex = new Regex(@"Добавлен:(.*)\n", RegexOptions.Compiled | RegexOptions.IgnoreCase); - public Animedia(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Animedia(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "Animedia", name: "Animedia", description: "Animedia is a public russian tracker and release group for anime.", @@ -43,6 +44,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/Anthelion.cs b/src/Jackett.Common/Indexers/Anthelion.cs index ea5eae8c5..a264937b5 100644 --- a/src/Jackett.Common/Indexers/Anthelion.cs +++ b/src/Jackett.Common/Indexers/Anthelion.cs @@ -30,7 +30,8 @@ namespace Jackett.Common.Indexers "https://tehconnection.me/" }; - public Anthelion(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Anthelion(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "anthelion", name: "Anthelion", // old name: TehConnection.me description: "A movies tracker", @@ -49,6 +50,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/AvistaZ.cs b/src/Jackett.Common/Indexers/AvistaZ.cs index 7a755c232..73d53a2cc 100644 --- a/src/Jackett.Common/Indexers/AvistaZ.cs +++ b/src/Jackett.Common/Indexers/AvistaZ.cs @@ -11,7 +11,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class AvistaZ : AvistazTracker { - public AvistaZ(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public AvistaZ(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "avistaz", name: "AvistaZ", description: "Aka AsiaTorrents", @@ -30,7 +31,9 @@ namespace Jackett.Common.Indexers configService: configService, client: wc, logger: l, - p: ps) + p: ps, + cs: cs + ) { AddCategoryMapping(1, TorznabCatType.Movies); AddCategoryMapping(1, TorznabCatType.MoviesUHD); diff --git a/src/Jackett.Common/Indexers/AwesomeHD.cs b/src/Jackett.Common/Indexers/AwesomeHD.cs index 5360f2b54..3ab092c44 100644 --- a/src/Jackett.Common/Indexers/AwesomeHD.cs +++ b/src/Jackett.Common/Indexers/AwesomeHD.cs @@ -24,7 +24,8 @@ namespace Jackett.Common.Indexers private readonly Regex _removeYearRegex = new Regex(@" [\(\[]?(19|20)\d{2}[\)\]]?$", RegexOptions.Compiled); private new ConfigurationDataPasskey configData => (ConfigurationDataPasskey)base.configData; - public AwesomeHD(IIndexerConfigurationService configService, Utils.Clients.WebClient c, Logger l, IProtectionService ps) + public AwesomeHD(IIndexerConfigurationService configService, Utils.Clients.WebClient c, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "awesomehd", name: "Awesome-HD", description: "An HD tracker", @@ -48,6 +49,7 @@ namespace Jackett.Common.Indexers client: c, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataPasskey("Note: You can find the Passkey in your profile, " + "next to Personal information.")) { diff --git a/src/Jackett.Common/Indexers/BB.cs b/src/Jackett.Common/Indexers/BB.cs index f0dd07182..8d94890c7 100644 --- a/src/Jackett.Common/Indexers/BB.cs +++ b/src/Jackett.Common/Indexers/BB.cs @@ -33,7 +33,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public BB(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public BB(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "bb", name: "bB", description: "bB is a Private Torrent Tracker for 0DAY / GENERAL", @@ -61,6 +62,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/BJShare.cs b/src/Jackett.Common/Indexers/BJShare.cs index a92ba68ba..653300e64 100644 --- a/src/Jackett.Common/Indexers/BJShare.cs +++ b/src/Jackett.Common/Indexers/BJShare.cs @@ -60,7 +60,8 @@ namespace Jackett.Common.Indexers {"greys anatomy", "grey's anatomy"} }; - public BJShare(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public BJShare(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "bjshare", name: "BJ-Share", description: "A brazilian tracker.", @@ -88,6 +89,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithRSSAndDisplay()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/BakaBT.cs b/src/Jackett.Common/Indexers/BakaBT.cs index 546814dde..18b75f445 100644 --- a/src/Jackett.Common/Indexers/BakaBT.cs +++ b/src/Jackett.Common/Indexers/BakaBT.cs @@ -35,7 +35,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public BakaBT(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) + public BakaBT(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "bakabt", name: "BakaBT", description: "Anime Comunity", @@ -59,6 +60,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBakaBT("To prevent 0-results-error, Enable the " + "Show-Adult-Content option in your BakaBT account Settings.")) { diff --git a/src/Jackett.Common/Indexers/BaseIndexer.cs b/src/Jackett.Common/Indexers/BaseIndexer.cs index 36c09f93f..edc5f06c8 100644 --- a/src/Jackett.Common/Indexers/BaseIndexer.cs +++ b/src/Jackett.Common/Indexers/BaseIndexer.cs @@ -36,6 +36,7 @@ namespace Jackett.Common.Indexers protected Logger logger; protected IIndexerConfigurationService configurationService; protected IProtectionService protectionService; + protected ICacheService cacheService; protected ConfigurationData configData; @@ -62,11 +63,12 @@ namespace Jackett.Common.Indexers // standard constructor used by most indexers public BaseIndexer(string link, string id, string name, string description, IIndexerConfigurationService configService, Logger logger, ConfigurationData configData, - IProtectionService p) + IProtectionService p, ICacheService cs) { this.logger = logger; configurationService = configService; protectionService = p; + cacheService = cs; if (!link.EndsWith("/", StringComparison.Ordinal)) throw new Exception("Site link must end with a slash."); @@ -378,14 +380,19 @@ namespace Jackett.Common.Indexers public virtual async Task ResultsForQuery(TorznabQuery query, bool isMetaIndexer) { if (!CanHandleQuery(query) || !CanHandleCategories(query, isMetaIndexer)) - return new IndexerResult(this, new ReleaseInfo[0]); + return new IndexerResult(this, new ReleaseInfo[0], false); + + var cachedReleases = cacheService.Search(this, query); + if (cachedReleases != null) + return new IndexerResult(this, cachedReleases, true); try { var results = await PerformQuery(query); results = FilterResults(query, results); results = FixResults(query, results); - return new IndexerResult(this, results); + cacheService.CacheResults(this, query, results.ToList()); + return new IndexerResult(this, results, false); } catch (Exception ex) { @@ -400,9 +407,9 @@ namespace Jackett.Common.Indexers { protected BaseWebIndexer(string link, string id, string name, string description, IIndexerConfigurationService configService, WebClient client, Logger logger, - ConfigurationData configData, IProtectionService p, TorznabCapabilities caps, - string downloadBase = null) - : base(link, id, name, description, configService, logger, configData, p) + ConfigurationData configData, IProtectionService p, ICacheService cacheService, + TorznabCapabilities caps, string downloadBase = null) + : base(link, id, name, description, configService, logger, configData, p, cacheService) { webclient = client; downloadUrlBase = downloadBase; @@ -410,8 +417,9 @@ namespace Jackett.Common.Indexers } // minimal constructor used by e.g. cardigann generic indexer - protected BaseWebIndexer(IIndexerConfigurationService configService, WebClient client, Logger logger, IProtectionService p) - : base("/", "", "", "", configService, logger, null, p) => webclient = client; + protected BaseWebIndexer(IIndexerConfigurationService configService, WebClient client, Logger logger, + IProtectionService p, ICacheService cacheService) + : base("/", "", "", "", configService, logger, null, p, cacheService) => webclient = client; public virtual async Task Download(Uri link) { @@ -658,7 +666,6 @@ namespace Jackett.Common.Indexers { var result = await base.ResultsForQuery(query, isMetaIndexer); result.Releases = CleanLinks(result.Releases); - return result; } @@ -696,9 +703,9 @@ namespace Jackett.Common.Indexers { protected BaseCachingWebIndexer(string link,string id, string name, string description, IIndexerConfigurationService configService, WebClient client, Logger logger, - ConfigurationData configData, IProtectionService p, TorznabCapabilities caps = null, - string downloadBase = null) - : base(link, id, name, description, configService, client, logger, configData, p, caps, downloadBase) + ConfigurationData configData, IProtectionService p, ICacheService cacheService, + TorznabCapabilities caps = null, string downloadBase = null) + : base(link, id, name, description, configService, client, logger, configData, p, cacheService, caps, downloadBase) { } @@ -710,6 +717,7 @@ namespace Jackett.Common.Indexers } } + // TODO: remove this implementation and use gloal cache protected static List cache = new List(); protected static readonly TimeSpan cacheTime = new TimeSpan(0, 9, 0); } diff --git a/src/Jackett.Common/Indexers/BitCityReloaded.cs b/src/Jackett.Common/Indexers/BitCityReloaded.cs index 1faa48a84..5adc73f24 100644 --- a/src/Jackett.Common/Indexers/BitCityReloaded.cs +++ b/src/Jackett.Common/Indexers/BitCityReloaded.cs @@ -30,7 +30,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public BitCityReloaded(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public BitCityReloaded(IIndexerConfigurationService configService, WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "bitcityreloaded", name: "Bit-City Reloaded", description: "A German general tracker.", @@ -58,6 +59,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithRSSAndDisplay("Only the results from the first search result page are shown, adjust your profile settings to show a reasonable amount (it looks like there's no maximum).")) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/BitHDTV.cs b/src/Jackett.Common/Indexers/BitHDTV.cs index e45319b85..74831bbd8 100644 --- a/src/Jackett.Common/Indexers/BitHDTV.cs +++ b/src/Jackett.Common/Indexers/BitHDTV.cs @@ -25,7 +25,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataCookie configData => (ConfigurationDataCookie)base.configData; - public BitHDTV(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public BitHDTV(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "bithdtv", name: "BIT-HDTV", description: "BIT-HDTV - Home of High Definition", @@ -45,6 +46,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataCookie("For best results, change the 'Torrents per page' setting to 100 in your profile.")) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/BroadcasTheNet.cs b/src/Jackett.Common/Indexers/BroadcasTheNet.cs index 4113abfba..b54024870 100644 --- a/src/Jackett.Common/Indexers/BroadcasTheNet.cs +++ b/src/Jackett.Common/Indexers/BroadcasTheNet.cs @@ -28,7 +28,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public BroadcasTheNet(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public BroadcasTheNet(IIndexerConfigurationService configService, WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "broadcasthenet", name: "BroadcasTheNet", description: "BroadcasTheNet (BTN) is an invite-only torrent tracker focused on TV shows", @@ -46,6 +47,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataAPIKey()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/BrokenStones.cs b/src/Jackett.Common/Indexers/BrokenStones.cs index 0fe9cb608..53fa82571 100644 --- a/src/Jackett.Common/Indexers/BrokenStones.cs +++ b/src/Jackett.Common/Indexers/BrokenStones.cs @@ -10,7 +10,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class BrokenStones : GazelleTracker { - public BrokenStones(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public BrokenStones(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "brokenstones", name: "BrokenStones", description: "Broken Stones is a Private site for MacOS and iOS APPS / GAMES", @@ -20,6 +21,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cs: cs, supportsFreeleechTokens: true) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/CGPeers.cs b/src/Jackett.Common/Indexers/CGPeers.cs index f007136c7..08e4bcfbf 100644 --- a/src/Jackett.Common/Indexers/CGPeers.cs +++ b/src/Jackett.Common/Indexers/CGPeers.cs @@ -14,7 +14,8 @@ namespace Jackett.Common.Indexers "https://www.cgpeers.com/" }; - public CGPeers(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public CGPeers(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "cgpeers", name: "CGPeers", description: "CGPeers is a Private Torrent Tracker for GRAPHICS SOFTWARE / TUTORIALS / ETC", @@ -24,6 +25,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cs: cs, supportsFreeleechTokens: true) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/CardigannIndexer.cs b/src/Jackett.Common/Indexers/CardigannIndexer.cs index c037ba3dc..b0312dcf2 100644 --- a/src/Jackett.Common/Indexers/CardigannIndexer.cs +++ b/src/Jackett.Common/Indexers/CardigannIndexer.cs @@ -58,11 +58,13 @@ namespace Jackett.Common.Indexers @$"\b({string.Join("|", _SupportedLogicFunctions.Select(Regex.Escape))})(?:\s+(\(?\.[^\)\s]+\)?|""[^""]+"")){{2,}}"); public CardigannIndexer(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, - IProtectionService ps, IndexerDefinition Definition) + IProtectionService ps, ICacheService cs, IndexerDefinition Definition) : base(configService: configService, client: wc, logger: l, - p: ps) + p: ps, + cacheService: cs + ) { this.Definition = Definition; Id = Definition.Id; diff --git a/src/Jackett.Common/Indexers/Cinecalidad.cs b/src/Jackett.Common/Indexers/Cinecalidad.cs index a91ba208a..cbf0a6c3e 100644 --- a/src/Jackett.Common/Indexers/Cinecalidad.cs +++ b/src/Jackett.Common/Indexers/Cinecalidad.cs @@ -31,7 +31,8 @@ namespace Jackett.Common.Indexers "https://www.cinecalidad.eu/" }; - public Cinecalidad(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Cinecalidad(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "cinecalidad", name: "Cinecalidad", description: "Películas Full HD en Castellano y Latino Dual.", @@ -43,6 +44,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/CinemaZ.cs b/src/Jackett.Common/Indexers/CinemaZ.cs index e6c7adf9e..cbb4c1b27 100644 --- a/src/Jackett.Common/Indexers/CinemaZ.cs +++ b/src/Jackett.Common/Indexers/CinemaZ.cs @@ -11,7 +11,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class CinemaZ : AvistazTracker { - public CinemaZ(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public CinemaZ(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "cinemaz", name: "CinemaZ", description: "Part of the Avistaz network.", @@ -30,7 +31,9 @@ namespace Jackett.Common.Indexers configService: configService, client: wc, logger: l, - p: ps) + p: ps, + cs: cs + ) { AddCategoryMapping(1, TorznabCatType.Movies); AddCategoryMapping(1, TorznabCatType.MoviesUHD); diff --git a/src/Jackett.Common/Indexers/DICMusic.cs b/src/Jackett.Common/Indexers/DICMusic.cs index fdda2a640..e7017fcb4 100644 --- a/src/Jackett.Common/Indexers/DICMusic.cs +++ b/src/Jackett.Common/Indexers/DICMusic.cs @@ -13,7 +13,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class DICMusic : GazelleTracker { - public DICMusic(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public DICMusic(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "dicmusic", name: "DICMusic", description: "DICMusic is a CHINESE Private Torrent Tracker for MUSIC", @@ -29,6 +30,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cs: cs, supportsFreeleechTokens: true, has2Fa: true) { diff --git a/src/Jackett.Common/Indexers/DarmoweTorrenty.cs b/src/Jackett.Common/Indexers/DarmoweTorrenty.cs index cac0eb2a2..7728534da 100644 --- a/src/Jackett.Common/Indexers/DarmoweTorrenty.cs +++ b/src/Jackett.Common/Indexers/DarmoweTorrenty.cs @@ -35,7 +35,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public DarmoweTorenty(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public DarmoweTorenty(IIndexerConfigurationService configService, WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "darmowetorenty", name: "Darmowe torenty", description: "Darmowe torenty is a POLISH Semi-Private Torrent Tracker for MOVIES / TV / GENERAL", @@ -63,6 +64,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithRSSAndDisplay()) { Encoding = Encoding.GetEncoding("iso-8859-2"); diff --git a/src/Jackett.Common/Indexers/DigitalCore.cs b/src/Jackett.Common/Indexers/DigitalCore.cs index b6f37adc3..6adb50ed1 100644 --- a/src/Jackett.Common/Indexers/DigitalCore.cs +++ b/src/Jackett.Common/Indexers/DigitalCore.cs @@ -29,7 +29,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public DigitalCore(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public DigitalCore(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "digitalcore", name: "DigitalCore", description: "DigitalCore is a Private Torrent Tracker for MOVIES / TV / GENERAL", @@ -57,6 +58,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataCookie()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/DivxTotal.cs b/src/Jackett.Common/Indexers/DivxTotal.cs index db9b1221c..7f5e09cd1 100644 --- a/src/Jackett.Common/Indexers/DivxTotal.cs +++ b/src/Jackett.Common/Indexers/DivxTotal.cs @@ -49,7 +49,8 @@ namespace Jackett.Common.Indexers "https://www.divxtotal.la/" }; - public DivxTotal(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public DivxTotal(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "divxtotal", name: "DivxTotal", description: "DivxTotal is a SPANISH site for Movies, TV series and Software", @@ -68,6 +69,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/EliteTracker.cs b/src/Jackett.Common/Indexers/EliteTracker.cs index 4d0db0756..9b55d171a 100644 --- a/src/Jackett.Common/Indexers/EliteTracker.cs +++ b/src/Jackett.Common/Indexers/EliteTracker.cs @@ -24,7 +24,8 @@ namespace Jackett.Common.Indexers private string BrowseUrl => SiteLink + "browse.php"; private new ConfigurationDataEliteTracker configData => (ConfigurationDataEliteTracker)base.configData; - public EliteTracker(IIndexerConfigurationService configService, WebClient webClient, Logger logger, IProtectionService protectionService) + public EliteTracker(IIndexerConfigurationService configService, WebClient webClient, Logger logger, + IProtectionService ps, ICacheService cs) : base(id: "elitetracker", name: "Elite-Tracker", description: "French Torrent Tracker", @@ -50,7 +51,8 @@ namespace Jackett.Common.Indexers }, configService: configService, logger: logger, - p: protectionService, + p: ps, + cacheService: cs, client: webClient, configData: new ConfigurationDataEliteTracker() ) diff --git a/src/Jackett.Common/Indexers/EpubLibre.cs b/src/Jackett.Common/Indexers/EpubLibre.cs index 3a2487db1..dc7039eb8 100644 --- a/src/Jackett.Common/Indexers/EpubLibre.cs +++ b/src/Jackett.Common/Indexers/EpubLibre.cs @@ -53,7 +53,8 @@ namespace Jackett.Common.Indexers "https://epublibre.unblockit.app/" }; - public EpubLibre(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public EpubLibre(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "epublibre", name: "EpubLibre", description: "Más libros, Más libres", @@ -69,6 +70,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/ExoticaZ.cs b/src/Jackett.Common/Indexers/ExoticaZ.cs index 284addfea..db8c77069 100644 --- a/src/Jackett.Common/Indexers/ExoticaZ.cs +++ b/src/Jackett.Common/Indexers/ExoticaZ.cs @@ -19,7 +19,8 @@ namespace Jackett.Common.Indexers "https://torrents.yourexotic.com/" }; - public ExoticaZ(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public ExoticaZ(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "exoticaz", name: "ExoticaZ", description: "ExoticaZ (YourExotic) is a Private Torrent Tracker for 3X", @@ -34,7 +35,9 @@ namespace Jackett.Common.Indexers configService: configService, client: wc, logger: l, - p: ps) + p: ps, + cs: cs + ) { AddCategoryMapping(1, TorznabCatType.XXXx264); AddCategoryMapping(2, TorznabCatType.XXXPack); diff --git a/src/Jackett.Common/Indexers/Feeds/AnimeTosho.cs b/src/Jackett.Common/Indexers/Feeds/AnimeTosho.cs index 50425cfa9..c6b98e293 100644 --- a/src/Jackett.Common/Indexers/Feeds/AnimeTosho.cs +++ b/src/Jackett.Common/Indexers/Feeds/AnimeTosho.cs @@ -16,7 +16,8 @@ namespace Jackett.Common.Indexers.Feeds [ExcludeFromCodeCoverage] public class AnimeTosho : BaseNewznabIndexer { - public AnimeTosho(IIndexerConfigurationService configService, WebClient client, Logger logger, IProtectionService ps) + public AnimeTosho(IIndexerConfigurationService configService, WebClient client, Logger logger, + IProtectionService ps, ICacheService cs) : base(id: "animetosho", name: "Anime Tosho", description: "AnimeTosho (AT) is an automated service that provides torrent files, magnet links and DDL for all anime releases", @@ -32,6 +33,7 @@ namespace Jackett.Common.Indexers.Feeds client: client, logger: logger, p: ps, + cs: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/Feeds/BaseFeedIndexer.cs b/src/Jackett.Common/Indexers/Feeds/BaseFeedIndexer.cs index a4a8e9b1b..a8fc3147d 100644 --- a/src/Jackett.Common/Indexers/Feeds/BaseFeedIndexer.cs +++ b/src/Jackett.Common/Indexers/Feeds/BaseFeedIndexer.cs @@ -18,8 +18,8 @@ namespace Jackett.Common.Indexers.Feeds protected BaseFeedIndexer(string link, string id, string name, string description, IIndexerConfigurationService configService, WebClient client, Logger logger, - ConfigurationData configData, IProtectionService p, TorznabCapabilities caps = null, - string downloadBase = null) + ConfigurationData configData, IProtectionService p, ICacheService cs, + TorznabCapabilities caps = null, string downloadBase = null) : base(id: id, name: name, description: description, @@ -29,6 +29,7 @@ namespace Jackett.Common.Indexers.Feeds client: client, logger: logger, p: p, + cacheService: cs, configData: configData, downloadBase: downloadBase) { diff --git a/src/Jackett.Common/Indexers/Feeds/BaseNewznabIndexer.cs b/src/Jackett.Common/Indexers/Feeds/BaseNewznabIndexer.cs index e2ac031f8..c0a8060b4 100644 --- a/src/Jackett.Common/Indexers/Feeds/BaseNewznabIndexer.cs +++ b/src/Jackett.Common/Indexers/Feeds/BaseNewznabIndexer.cs @@ -17,8 +17,8 @@ namespace Jackett.Common.Indexers.Feeds { protected BaseNewznabIndexer(string link, string id, string name, string description, IIndexerConfigurationService configService, WebClient client, Logger logger, - ConfigurationData configData, IProtectionService p, TorznabCapabilities caps = null, - string downloadBase = null) + ConfigurationData configData, IProtectionService p, ICacheService cs, + TorznabCapabilities caps = null, string downloadBase = null) : base(id: id, name: name, description: description, @@ -28,6 +28,7 @@ namespace Jackett.Common.Indexers.Feeds client: client, logger: logger, p: p, + cs: cs, configData: configData, downloadBase: downloadBase) { diff --git a/src/Jackett.Common/Indexers/FileList.cs b/src/Jackett.Common/Indexers/FileList.cs index 724d23671..437eb2fb9 100644 --- a/src/Jackett.Common/Indexers/FileList.cs +++ b/src/Jackett.Common/Indexers/FileList.cs @@ -30,7 +30,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataFileList configData => (ConfigurationDataFileList)base.configData; - public FileList(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public FileList(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "filelist", name: "FileList", description: "The best Romanian site.", @@ -58,6 +59,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataFileList()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/FunFile.cs b/src/Jackett.Common/Indexers/FunFile.cs index 4d225b2fd..699a85a8d 100644 --- a/src/Jackett.Common/Indexers/FunFile.cs +++ b/src/Jackett.Common/Indexers/FunFile.cs @@ -23,7 +23,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; - public FunFile(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public FunFile(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "funfile", name: "FunFile", description: "A general tracker", @@ -51,6 +52,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin("For best results, change the 'Torrents per page' setting to 100 in your profile.")) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/Fuzer.cs b/src/Jackett.Common/Indexers/Fuzer.cs index bcebeb4de..721751b3c 100644 --- a/src/Jackett.Common/Indexers/Fuzer.cs +++ b/src/Jackett.Common/Indexers/Fuzer.cs @@ -30,7 +30,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataCookie configData => (ConfigurationDataCookie)base.configData; - public Fuzer(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public Fuzer(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "fuzer", name: "Fuzer", description: "Fuzer is a private torrent website with israeli torrents.", @@ -58,6 +59,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataCookie()) { Encoding = Encoding.GetEncoding("windows-1255"); diff --git a/src/Jackett.Common/Indexers/GazelleGames.cs b/src/Jackett.Common/Indexers/GazelleGames.cs index db2b97185..a4193c7d0 100644 --- a/src/Jackett.Common/Indexers/GazelleGames.cs +++ b/src/Jackett.Common/Indexers/GazelleGames.cs @@ -30,7 +30,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public GazelleGames(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public GazelleGames(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "gazellegames", name: "GazelleGames", description: "A gaming tracker.", @@ -40,6 +41,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataCookie()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/GimmePeers.cs b/src/Jackett.Common/Indexers/GimmePeers.cs index 3397dfe69..96fb6f737 100644 --- a/src/Jackett.Common/Indexers/GimmePeers.cs +++ b/src/Jackett.Common/Indexers/GimmePeers.cs @@ -29,7 +29,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public GimmePeers(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public GimmePeers(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "gimmepeers", name: "GimmePeers", description: "Formerly ILT", @@ -57,6 +58,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/HDBitsApi.cs b/src/Jackett.Common/Indexers/HDBitsApi.cs index b9c8c7212..8902e91c1 100644 --- a/src/Jackett.Common/Indexers/HDBitsApi.cs +++ b/src/Jackett.Common/Indexers/HDBitsApi.cs @@ -25,7 +25,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public HDBitsApi(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public HDBitsApi(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "hdbitsapi", name: "HDBits (API)", description: "The HighDefinition Bittorrent Community", @@ -45,6 +46,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataHDBitsApi()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/HDSpace.cs b/src/Jackett.Common/Indexers/HDSpace.cs index 8c828a16f..2a01f0003 100644 --- a/src/Jackett.Common/Indexers/HDSpace.cs +++ b/src/Jackett.Common/Indexers/HDSpace.cs @@ -25,7 +25,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; - public HDSpace(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public HDSpace(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "hdspace", name: "HD-Space", description: "Sharing The Universe", @@ -49,6 +50,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/HDTorrents.cs b/src/Jackett.Common/Indexers/HDTorrents.cs index 2ea6c16f2..d730fbb84 100644 --- a/src/Jackett.Common/Indexers/HDTorrents.cs +++ b/src/Jackett.Common/Indexers/HDTorrents.cs @@ -44,7 +44,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; - public HDTorrents(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public HDTorrents(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "hdtorrents", name: "HD-Torrents", description: "HD-Torrents is a private torrent website with HD torrents and strict rules on their content.", @@ -68,6 +69,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin( "For best results, change the Torrents per page: setting to 100 on your account profile.")) { diff --git a/src/Jackett.Common/Indexers/Hebits.cs b/src/Jackett.Common/Indexers/Hebits.cs index 5910f44d1..1b4b4e795 100644 --- a/src/Jackett.Common/Indexers/Hebits.cs +++ b/src/Jackett.Common/Indexers/Hebits.cs @@ -29,7 +29,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public Hebits(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) + public Hebits(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "hebits", name: "Hebits", description: "The Israeli Tracker", @@ -57,6 +58,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, downloadBase: "https://hebits.net/", configData: new ConfigurationDataBasicLogin()) { diff --git a/src/Jackett.Common/Indexers/IIndexer.cs b/src/Jackett.Common/Indexers/IIndexer.cs index 088dd8cb2..484839171 100644 --- a/src/Jackett.Common/Indexers/IIndexer.cs +++ b/src/Jackett.Common/Indexers/IIndexer.cs @@ -12,11 +12,13 @@ namespace Jackett.Common.Indexers { public IIndexer Indexer { get; set; } public IEnumerable Releases { get; set; } + public bool IsFromCache; - public IndexerResult(IIndexer Indexer, IEnumerable Releases) + public IndexerResult(IIndexer indexer, IEnumerable releases, bool isFromCache) { - this.Indexer = Indexer; - this.Releases = Releases; + Indexer = indexer; + Releases = releases; + IsFromCache = isFromCache; } } diff --git a/src/Jackett.Common/Indexers/IPTorrents.cs b/src/Jackett.Common/Indexers/IPTorrents.cs index 0522bdd0c..40ead53c0 100644 --- a/src/Jackett.Common/Indexers/IPTorrents.cs +++ b/src/Jackett.Common/Indexers/IPTorrents.cs @@ -49,7 +49,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataCookie configData => (ConfigurationDataCookie)base.configData; - public IPTorrents(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public IPTorrents(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "iptorrents", name: "IPTorrents", description: "Always a step ahead.", @@ -77,6 +78,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataCookie("For best results, change the 'Torrents per page' option to 100 and check the 'Torrents - Show files count' option in the website Settings.")) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/ImmortalSeed.cs b/src/Jackett.Common/Indexers/ImmortalSeed.cs index d0b996957..5f6e3f757 100644 --- a/src/Jackett.Common/Indexers/ImmortalSeed.cs +++ b/src/Jackett.Common/Indexers/ImmortalSeed.cs @@ -33,7 +33,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public ImmortalSeed(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) + public ImmortalSeed(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "immortalseed", name: "ImmortalSeed", description: "ImmortalSeed (iS) is a Private Torrent Tracker for MOVIES / TV / GENERAL", @@ -61,6 +62,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/InternetArchive.cs b/src/Jackett.Common/Indexers/InternetArchive.cs index 4cad1e96d..23c29ecd8 100644 --- a/src/Jackett.Common/Indexers/InternetArchive.cs +++ b/src/Jackett.Common/Indexers/InternetArchive.cs @@ -32,7 +32,8 @@ namespace Jackett.Common.Indexers private ConfigurationData ConfigData => configData; - public InternetArchive(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public InternetArchive(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "internetarchive", name: "Internet Archive", description: "Internet Archive is a non-profit digital library offering free universal access to books, movies & music, as well as 406 billion archived web pages", @@ -60,6 +61,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/Libble.cs b/src/Jackett.Common/Indexers/Libble.cs index 4757ade91..d686aa80a 100644 --- a/src/Jackett.Common/Indexers/Libble.cs +++ b/src/Jackett.Common/Indexers/Libble.cs @@ -55,7 +55,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public Libble(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Libble(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "libble", name: "Libble", description: "Libble is a Private Torrent Tracker for MUSIC", @@ -71,6 +72,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/LostFilm.cs b/src/Jackett.Common/Indexers/LostFilm.cs index fd57868b3..be428e564 100644 --- a/src/Jackett.Common/Indexers/LostFilm.cs +++ b/src/Jackett.Common/Indexers/LostFilm.cs @@ -93,7 +93,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public LostFilm(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public LostFilm(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "lostfilm", name: "LostFilm.tv", description: "Unique portal about foreign series", @@ -112,6 +113,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataCaptchaLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/Magnetico.cs b/src/Jackett.Common/Indexers/Magnetico.cs index e7cb1438b..af881386f 100644 --- a/src/Jackett.Common/Indexers/Magnetico.cs +++ b/src/Jackett.Common/Indexers/Magnetico.cs @@ -23,7 +23,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; - public Magnetico(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Magnetico(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "magnetico", name: "Magnetico (Local DHT)", description: "Magnetico is a self-hosted BitTorrent DHT search engine", @@ -51,6 +52,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin("Configure the URL, username and password from your local magneticow.
" + "Default credentials are: username=username, password=password.
" + "If you have many torrents, it is recommended to use PostgreSQL database to make queries faster. With SQLite, timeouts may occur.")) diff --git a/src/Jackett.Common/Indexers/MejorTorrent.cs b/src/Jackett.Common/Indexers/MejorTorrent.cs index 8d91c41a9..e433de24f 100644 --- a/src/Jackett.Common/Indexers/MejorTorrent.cs +++ b/src/Jackett.Common/Indexers/MejorTorrent.cs @@ -43,7 +43,8 @@ namespace Jackett.Common.Indexers "http://www.mejortorrentt.org/" }; - public MejorTorrent(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public MejorTorrent(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "mejortorrent", name: "MejorTorrent", description: "MejorTorrent - Hay veces que un torrent viene mejor! :)", @@ -67,6 +68,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/Meta/BaseMetaIndexer.cs b/src/Jackett.Common/Indexers/Meta/BaseMetaIndexer.cs index 4eb8982ac..87690dbac 100644 --- a/src/Jackett.Common/Indexers/Meta/BaseMetaIndexer.cs +++ b/src/Jackett.Common/Indexers/Meta/BaseMetaIndexer.cs @@ -17,8 +17,8 @@ namespace Jackett.Common.Indexers.Meta protected BaseMetaIndexer(string name, string id, string description, IFallbackStrategyProvider fallbackStrategyProvider, IResultFilterProvider resultFilterProvider,IIndexerConfigurationService configService, - WebClient client, Logger logger, ConfigurationData configData, IProtectionService p, - Func filter) + WebClient client, Logger logger, ConfigurationData configData, IProtectionService ps, + ICacheService cs, Func filter) : base(id: id, name: name, description: description, @@ -27,7 +27,8 @@ namespace Jackett.Common.Indexers.Meta configService: configService, client: client, logger: logger, - p: p, + p: ps, + cacheService: cs, configData: configData) { filterFunc = filter; @@ -49,13 +50,14 @@ namespace Jackett.Common.Indexers.Meta public override async Task ResultsForQuery(TorznabQuery query, bool isMetaIndexer) { if (!CanHandleQuery(query) || !CanHandleCategories(query, true)) - return new IndexerResult(this, new ReleaseInfo[0]); + return new IndexerResult(this, new ReleaseInfo[0], false); try { var results = await PerformQuery(query); // the results are already filtered and fixed by each indexer - return new IndexerResult(this, results); + // some results may come from cache, but we can't inform without refactor the code + return new IndexerResult(this, results, false); } catch (Exception ex) { diff --git a/src/Jackett.Common/Indexers/Meta/MetaIndexers.cs b/src/Jackett.Common/Indexers/Meta/MetaIndexers.cs index 76bb2093a..bd8459b12 100644 --- a/src/Jackett.Common/Indexers/Meta/MetaIndexers.cs +++ b/src/Jackett.Common/Indexers/Meta/MetaIndexers.cs @@ -10,14 +10,15 @@ namespace Jackett.Common.Indexers.Meta { public AggregateIndexer(IFallbackStrategyProvider fallbackStrategyProvider, IResultFilterProvider resultFilterProvider, IIndexerConfigurationService configService, - WebClient client, Logger logger, IProtectionService ps) + WebClient client, Logger logger, IProtectionService ps, ICacheService cs) : base(id: "all", name: "AggregateSearch", description: "This feed includes all configured trackers", configService: configService, client: client, logger: logger, - p: ps, + ps: ps, + cs: cs, configData: new ConfigurationData(), fallbackStrategyProvider: fallbackStrategyProvider, resultFilterProvider: resultFilterProvider, diff --git a/src/Jackett.Common/Indexers/Milkie.cs b/src/Jackett.Common/Indexers/Milkie.cs index aba7f5748..10bc6a3a8 100644 --- a/src/Jackett.Common/Indexers/Milkie.cs +++ b/src/Jackett.Common/Indexers/Milkie.cs @@ -23,7 +23,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataAPIKey configData => (ConfigurationDataAPIKey)base.configData; - public Milkie(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Milkie(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "milkie", name: "Milkie", description: "Milkie.cc (ME) is private torrent tracker for 0day / general", @@ -51,6 +52,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataAPIKey()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/MoreThanTV.cs b/src/Jackett.Common/Indexers/MoreThanTV.cs index 5a1038413..b5efa5b07 100644 --- a/src/Jackett.Common/Indexers/MoreThanTV.cs +++ b/src/Jackett.Common/Indexers/MoreThanTV.cs @@ -33,7 +33,8 @@ namespace Jackett.Common.Indexers private ConfigurationDataBasicLogin ConfigData => (ConfigurationDataBasicLogin)configData; - public MoreThanTV(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps) + public MoreThanTV(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "morethantv", name: "MoreThanTV", description: "Private torrent tracker for TV / MOVIES, and the internal tracker for the release group DRACULA.", @@ -53,6 +54,7 @@ namespace Jackett.Common.Indexers client: c, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/MyAnonamouse.cs b/src/Jackett.Common/Indexers/MyAnonamouse.cs index 7d714538a..4b2ec1e57 100644 --- a/src/Jackett.Common/Indexers/MyAnonamouse.cs +++ b/src/Jackett.Common/Indexers/MyAnonamouse.cs @@ -24,7 +24,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataMyAnonamouse configData => (ConfigurationDataMyAnonamouse)base.configData; - public MyAnonamouse(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps) + public MyAnonamouse(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "myanonamouse", name: "MyAnonamouse", description: "Friendliness, Warmth and Sharing", @@ -40,6 +41,7 @@ namespace Jackett.Common.Indexers client: c, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataMyAnonamouse()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/NCore.cs b/src/Jackett.Common/Indexers/NCore.cs index 0577dd7f3..83fde1013 100644 --- a/src/Jackett.Common/Indexers/NCore.cs +++ b/src/Jackett.Common/Indexers/NCore.cs @@ -41,35 +41,37 @@ namespace Jackett.Common.Indexers "ebook" }; - public NCore(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) : - base(id: "ncore", - name: "nCore", - description: "A Hungarian private torrent site.", - link: "https://ncore.cc/", - caps: new TorznabCapabilities - { - TvSearchParams = new List - { - TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId - }, - MovieSearchParams = new List - { - MovieSearchParam.Q, MovieSearchParam.ImdbId - }, - MusicSearchParams = new List - { - MusicSearchParam.Q - }, - BookSearchParams = new List - { - BookSearchParam.Q - } - }, - configService: configService, - client: wc, - logger: l, - p: ps, - configData: new ConfigurationDataNCore()) + public NCore(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) + : base(id: "ncore", + name: "nCore", + description: "A Hungarian private torrent site.", + link: "https://ncore.cc/", + caps: new TorznabCapabilities + { + TvSearchParams = new List + { + TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId + }, + MovieSearchParams = new List + { + MovieSearchParam.Q, MovieSearchParam.ImdbId + }, + MusicSearchParams = new List + { + MusicSearchParam.Q + }, + BookSearchParams = new List + { + BookSearchParam.Q + } + }, + configService: configService, + client: wc, + logger: l, + p: ps, + cacheService: cs, + configData: new ConfigurationDataNCore()) { Encoding = Encoding.UTF8; Language = "hu-hu"; diff --git a/src/Jackett.Common/Indexers/Nebulance.cs b/src/Jackett.Common/Indexers/Nebulance.cs index c1ea30976..1aa13de01 100644 --- a/src/Jackett.Common/Indexers/Nebulance.cs +++ b/src/Jackett.Common/Indexers/Nebulance.cs @@ -24,7 +24,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLoginWith2FA configData => (ConfigurationDataBasicLoginWith2FA)base.configData; - public Nebulance(IIndexerConfigurationService configService, Utils.Clients.WebClient c, Logger l, IProtectionService ps) + public Nebulance(IIndexerConfigurationService configService, Utils.Clients.WebClient c, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "nebulance", name: "Nebulance", description: "At Nebulance we will change the way you think about TV", @@ -40,6 +41,7 @@ namespace Jackett.Common.Indexers client: c, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWith2FA(@"If 2FA is disabled, let the field empty. We recommend to disable 2FA because re-login will require manual actions.
For best results, change the 'Torrents per page' setting to 100 in your profile on the NBL webpage.")) diff --git a/src/Jackett.Common/Indexers/NewPCT.cs b/src/Jackett.Common/Indexers/NewPCT.cs index 72b3322ef..e14e50aeb 100644 --- a/src/Jackett.Common/Indexers/NewPCT.cs +++ b/src/Jackett.Common/Indexers/NewPCT.cs @@ -116,7 +116,8 @@ namespace Jackett.Common.Indexers "https://pctnew.org/" }; - public NewPCT(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public NewPCT(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "newpct", name: "NewPCT", description: "NewPCT - Descargar peliculas, series y estrenos torrent gratis", @@ -135,6 +136,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.GetEncoding("windows-1252"); diff --git a/src/Jackett.Common/Indexers/NewRealWorld.cs b/src/Jackett.Common/Indexers/NewRealWorld.cs index 3ab9496ac..722c851bf 100644 --- a/src/Jackett.Common/Indexers/NewRealWorld.cs +++ b/src/Jackett.Common/Indexers/NewRealWorld.cs @@ -29,7 +29,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public NewRealWorld(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public NewRealWorld(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "newrealworld", name: "New Real World", description: "A German general tracker.", @@ -57,6 +58,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithRSSAndDisplay()) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/NorBits.cs b/src/Jackett.Common/Indexers/NorBits.cs index 472aeaed9..0be6d9834 100644 --- a/src/Jackett.Common/Indexers/NorBits.cs +++ b/src/Jackett.Common/Indexers/NorBits.cs @@ -41,7 +41,8 @@ namespace Jackett.Common.Indexers private ConfigurationDataNorbits ConfigData => (ConfigurationDataNorbits)configData; - public NorBits(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public NorBits(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "norbits", name: "NorBits", description: "NorBits is a Norwegian Private site for MOVIES / TV / GENERAL", @@ -69,6 +70,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataNorbits()) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/NotWhatCD.cs b/src/Jackett.Common/Indexers/NotWhatCD.cs index 682833499..6add2bcc5 100644 --- a/src/Jackett.Common/Indexers/NotWhatCD.cs +++ b/src/Jackett.Common/Indexers/NotWhatCD.cs @@ -11,7 +11,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class NotWhatCD : GazelleTracker { - public NotWhatCD(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public NotWhatCD(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "notwhatcd", name: "notwhat.cd", description: "A music tracker", @@ -39,6 +40,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cs: cs, supportsFreeleechTokens: true) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/Orpheus.cs b/src/Jackett.Common/Indexers/Orpheus.cs index d738090a8..52affe4f0 100644 --- a/src/Jackett.Common/Indexers/Orpheus.cs +++ b/src/Jackett.Common/Indexers/Orpheus.cs @@ -11,7 +11,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class Orpheus : GazelleTracker { - public Orpheus(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Orpheus(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "orpheus", name: "Orpheus", description: "A music tracker", @@ -39,6 +40,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cs: cs, supportsFreeleechTokens: true, has2Fa: true) { diff --git a/src/Jackett.Common/Indexers/Partis.cs b/src/Jackett.Common/Indexers/Partis.cs index fd2d2c95f..36269a7b2 100644 --- a/src/Jackett.Common/Indexers/Partis.cs +++ b/src/Jackett.Common/Indexers/Partis.cs @@ -28,7 +28,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public Partis(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Partis(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "partis", name: "Partis", description: "Partis is a SLOVENIAN Private Torrent Tracker", @@ -56,6 +57,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/PassThePopcorn.cs b/src/Jackett.Common/Indexers/PassThePopcorn.cs index d15256e8b..0513de144 100644 --- a/src/Jackett.Common/Indexers/PassThePopcorn.cs +++ b/src/Jackett.Common/Indexers/PassThePopcorn.cs @@ -30,7 +30,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public PassThePopcorn(IIndexerConfigurationService configService, Utils.Clients.WebClient c, Logger l, IProtectionService ps) + public PassThePopcorn(IIndexerConfigurationService configService, Utils.Clients.WebClient c, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "passthepopcorn", name: "PassThePopcorn", description: "PassThePopcorn is a Private site for MOVIES / TV", @@ -50,6 +51,7 @@ namespace Jackett.Common.Indexers client: c, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataAPILoginWithUserAndPasskeyAndFilter(@"Enter filter options below to restrict search results. Separate options with a space if using more than one option.
Filter options available:
GoldenPopcorn
Scene
Checked
Free")) diff --git a/src/Jackett.Common/Indexers/PirateTheNet.cs b/src/Jackett.Common/Indexers/PirateTheNet.cs index f6d45bc35..515ed6c8d 100644 --- a/src/Jackett.Common/Indexers/PirateTheNet.cs +++ b/src/Jackett.Common/Indexers/PirateTheNet.cs @@ -31,7 +31,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public PirateTheNet(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public PirateTheNet(IIndexerConfigurationService configService, WebClient w, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "piratethenet", name: "PirateTheNet", description: "A movie tracker", @@ -47,6 +48,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithRSSAndDisplay("Only the results from the first search result page are shown, adjust your profile settings to show the maximum.")) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/PixelHD.cs b/src/Jackett.Common/Indexers/PixelHD.cs index fe19367f2..04f105e9a 100644 --- a/src/Jackett.Common/Indexers/PixelHD.cs +++ b/src/Jackett.Common/Indexers/PixelHD.cs @@ -32,7 +32,8 @@ namespace Jackett.Common.Indexers private string input_username = null; private string input_password = null; - public PixelHD(IIndexerConfigurationService configService, WebClient webClient, Logger logger, IProtectionService protectionService) + public PixelHD(IIndexerConfigurationService configService, WebClient webClient, Logger logger, + IProtectionService ps, ICacheService cs) : base(id: "pixelhd", name: "PiXELHD", description: "PixelHD (PxHD) is a Private Torrent Tracker for HD .MP4 MOVIES / TV", @@ -46,7 +47,8 @@ namespace Jackett.Common.Indexers }, configService: configService, logger: logger, - p: protectionService, + p: ps, + cacheService: cs, client: webClient, configData: new ConfigurationDataCaptchaLogin() ) diff --git a/src/Jackett.Common/Indexers/PolishTracker.cs b/src/Jackett.Common/Indexers/PolishTracker.cs index 49d243079..d03ca9e92 100644 --- a/src/Jackett.Common/Indexers/PolishTracker.cs +++ b/src/Jackett.Common/Indexers/PolishTracker.cs @@ -27,7 +27,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataCookie configData => (ConfigurationDataCookie)base.configData; - public PolishTracker(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public PolishTracker(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "polishtracker", name: "PolishTracker", description: "Polish Tracker is a POLISH Private site for 0DAY / MOVIES / GENERAL", @@ -55,6 +56,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataCookie()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/PornoLab.cs b/src/Jackett.Common/Indexers/PornoLab.cs index ea3f26c78..e8131b15a 100644 --- a/src/Jackett.Common/Indexers/PornoLab.cs +++ b/src/Jackett.Common/Indexers/PornoLab.cs @@ -33,7 +33,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public PornoLab(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public PornoLab(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "pornolab", name: "PornoLab", description: "PornoLab is a Semi-Private Russian site for Adult content", @@ -43,6 +44,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataPornolab()) { Encoding = Encoding.GetEncoding("windows-1251"); diff --git a/src/Jackett.Common/Indexers/PreToMe.cs b/src/Jackett.Common/Indexers/PreToMe.cs index f6586f062..e2f23927a 100644 --- a/src/Jackett.Common/Indexers/PreToMe.cs +++ b/src/Jackett.Common/Indexers/PreToMe.cs @@ -23,7 +23,8 @@ namespace Jackett.Common.Indexers private string SearchUrl => SiteLink + "browse.php"; private new ConfigurationDataPinNumber configData => (ConfigurationDataPinNumber)base.configData; - public PreToMe(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public PreToMe(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "pretome", name: "PreToMe", description: "BitTorrent site for High Quality, High Definition (HD) movies and TV Shows", @@ -51,6 +52,7 @@ namespace Jackett.Common.Indexers configService: configService, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataPinNumber("For best results, change the 'Torrents per page' setting to 100 in 'Profile => Torrent browse settings'.")) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/PrivateHD.cs b/src/Jackett.Common/Indexers/PrivateHD.cs index e3b8e642b..298c525b9 100644 --- a/src/Jackett.Common/Indexers/PrivateHD.cs +++ b/src/Jackett.Common/Indexers/PrivateHD.cs @@ -11,7 +11,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class PrivateHD : AvistazTracker { - public PrivateHD(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public PrivateHD(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "privatehd", name: "PrivateHD", description: "BitTorrent site for High Quality, High Definition (HD) movies and TV Shows", @@ -34,7 +35,9 @@ namespace Jackett.Common.Indexers configService: configService, client: wc, logger: l, - p: ps) + p: ps, + cs: cs + ) { AddCategoryMapping(1, TorznabCatType.Movies); AddCategoryMapping(1, TorznabCatType.MoviesUHD); diff --git a/src/Jackett.Common/Indexers/PsyTorrents.cs b/src/Jackett.Common/Indexers/PsyTorrents.cs index bb743ab65..f43e4c0a4 100644 --- a/src/Jackett.Common/Indexers/PsyTorrents.cs +++ b/src/Jackett.Common/Indexers/PsyTorrents.cs @@ -12,7 +12,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class PsyTorrents : GazelleTracker { - public PsyTorrents(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public PsyTorrents(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "psytorrents", name: "Psytorrents", description: "Psytorrents (PSY) is a Private Torrent Tracker for ELECTRONIC MUSIC", @@ -32,6 +33,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cs: cs, supportsFreeleechTokens: true) { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/RarBG.cs b/src/Jackett.Common/Indexers/RarBG.cs index d5084ef49..332249d21 100644 --- a/src/Jackett.Common/Indexers/RarBG.cs +++ b/src/Jackett.Common/Indexers/RarBG.cs @@ -30,7 +30,8 @@ namespace Jackett.Common.Indexers private new ConfigurationData configData => base.configData; - public RarBG(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) + public RarBG(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "rarbg", name: "RARBG", description: "RARBG is a Public torrent site for MOVIES / TV / GENERAL", @@ -58,6 +59,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.GetEncoding("windows-1252"); diff --git a/src/Jackett.Common/Indexers/Redacted.cs b/src/Jackett.Common/Indexers/Redacted.cs index 68eaae5fa..c3f5f7f36 100644 --- a/src/Jackett.Common/Indexers/Redacted.cs +++ b/src/Jackett.Common/Indexers/Redacted.cs @@ -15,7 +15,8 @@ namespace Jackett.Common.Indexers { protected override string DownloadUrl => SiteLink + "torrents.php?action=download&usetoken=" + (useTokens ? "1" : "0") + "&id="; - public Redacted(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Redacted(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "redacted", name: "Redacted", description: "A music tracker", @@ -43,6 +44,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cs: cs, supportsFreeleechTokens: true, has2Fa: true, useApiKey: false diff --git a/src/Jackett.Common/Indexers/RevolutionTT.cs b/src/Jackett.Common/Indexers/RevolutionTT.cs index 1a4417b8d..ad62ed4fe 100644 --- a/src/Jackett.Common/Indexers/RevolutionTT.cs +++ b/src/Jackett.Common/Indexers/RevolutionTT.cs @@ -25,7 +25,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; - public RevolutionTT(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) + public RevolutionTT(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "revolutiontt", name: "RevolutionTT", description: "The Revolution has begun", @@ -53,6 +54,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin("For best results, change the 'Torrents per page' setting to 100 in your Profile.")) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/RuTracker.cs b/src/Jackett.Common/Indexers/RuTracker.cs index 2070b5314..9ed906fcd 100644 --- a/src/Jackett.Common/Indexers/RuTracker.cs +++ b/src/Jackett.Common/Indexers/RuTracker.cs @@ -34,7 +34,8 @@ namespace Jackett.Common.Indexers "https://rutracker.net/" }; - public RuTracker(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public RuTracker(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "rutracker", name: "RuTracker", description: "RuTracker is a Semi-Private Russian torrent site with a thriving file-sharing community", @@ -62,6 +63,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataRutracker()) { Encoding = Encoding.GetEncoding("windows-1251"); diff --git a/src/Jackett.Common/Indexers/SceneHD.cs b/src/Jackett.Common/Indexers/SceneHD.cs index 3359c5109..644dca44f 100644 --- a/src/Jackett.Common/Indexers/SceneHD.cs +++ b/src/Jackett.Common/Indexers/SceneHD.cs @@ -25,7 +25,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataPasskey configData => (ConfigurationDataPasskey)base.configData; - public SceneHD(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps) + public SceneHD(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "scenehd", name: "SceneHD", description: "SceneHD is Private site for HD TV / MOVIES", @@ -49,6 +50,7 @@ namespace Jackett.Common.Indexers client: c, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataPasskey("You can find the Passkey if you generate a RSS " + "feed link. It's the last parameter in the URL.")) { diff --git a/src/Jackett.Common/Indexers/SceneTime.cs b/src/Jackett.Common/Indexers/SceneTime.cs index b9f5f1182..46a6aebad 100644 --- a/src/Jackett.Common/Indexers/SceneTime.cs +++ b/src/Jackett.Common/Indexers/SceneTime.cs @@ -25,7 +25,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataSceneTime configData => (ConfigurationDataSceneTime)base.configData; - public SceneTime(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public SceneTime(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "scenetime", name: "SceneTime", description: "Always on time", @@ -53,6 +54,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataSceneTime()) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/SecretCinema.cs b/src/Jackett.Common/Indexers/SecretCinema.cs index bfa128400..e8f7377eb 100644 --- a/src/Jackett.Common/Indexers/SecretCinema.cs +++ b/src/Jackett.Common/Indexers/SecretCinema.cs @@ -14,7 +14,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class SecretCinema : GazelleTracker { - public SecretCinema(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public SecretCinema(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "secretcinema", name: "Secret Cinema", description: "A tracker for rare movies.", @@ -34,6 +35,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cs: cs, supportsFreeleechTokens: false) // ratioless tracker { Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/Shazbat.cs b/src/Jackett.Common/Indexers/Shazbat.cs index c5f1ea3cf..8f16d3181 100644 --- a/src/Jackett.Common/Indexers/Shazbat.cs +++ b/src/Jackett.Common/Indexers/Shazbat.cs @@ -31,7 +31,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public Shazbat(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps) + public Shazbat(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "shazbat", name: "Shazbat", description: "Modern indexer", @@ -47,6 +48,7 @@ namespace Jackett.Common.Indexers client: c, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithRSS()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/ShizaProject.cs b/src/Jackett.Common/Indexers/ShizaProject.cs index 6982b53b4..d394a4adc 100644 --- a/src/Jackett.Common/Indexers/ShizaProject.cs +++ b/src/Jackett.Common/Indexers/ShizaProject.cs @@ -19,7 +19,8 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] internal class ShizaProject : BaseWebIndexer { - public ShizaProject(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public ShizaProject(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "ShizaProject", name: "ShizaProject", description: "ShizaProject Tracker is a semi-private russian tracker and release group for anime", @@ -35,6 +36,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithEmail()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/ShowRSS.cs b/src/Jackett.Common/Indexers/ShowRSS.cs index 1decb79e5..bc22be13e 100644 --- a/src/Jackett.Common/Indexers/ShowRSS.cs +++ b/src/Jackett.Common/Indexers/ShowRSS.cs @@ -26,7 +26,8 @@ namespace Jackett.Common.Indexers private new ConfigurationData configData => base.configData; - public ShowRSS(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public ShowRSS(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "showrss", name: "ShowRSS", description: "showRSS is a service that allows you to keep track of your favorite TV shows", @@ -42,6 +43,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/SolidTorrents.cs b/src/Jackett.Common/Indexers/SolidTorrents.cs index 8c85a0316..4bc38b12d 100644 --- a/src/Jackett.Common/Indexers/SolidTorrents.cs +++ b/src/Jackett.Common/Indexers/SolidTorrents.cs @@ -35,7 +35,8 @@ namespace Jackett.Common.Indexers set => configData = value; } - public SolidTorrents(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public SolidTorrents(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "solidtorrents", name: "Solid Torrents", description: "Solid Torrents is a Public torrent meta-search engine", @@ -63,6 +64,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/SpeedApp.cs b/src/Jackett.Common/Indexers/SpeedApp.cs index 00d42d38e..3b846c1ae 100644 --- a/src/Jackett.Common/Indexers/SpeedApp.cs +++ b/src/Jackett.Common/Indexers/SpeedApp.cs @@ -44,7 +44,8 @@ namespace Jackett.Common.Indexers "https://www.myxz.org/" }; - public SpeedApp(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public SpeedApp(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base( id: "speedapp", name: "SpeedApp", @@ -73,6 +74,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithEmail()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/SpeedCD.cs b/src/Jackett.Common/Indexers/SpeedCD.cs index 569cef905..84c26963c 100644 --- a/src/Jackett.Common/Indexers/SpeedCD.cs +++ b/src/Jackett.Common/Indexers/SpeedCD.cs @@ -32,7 +32,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; - public SpeedCD(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public SpeedCD(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "speedcd", name: "Speed.cd", description: "Your home now!", @@ -60,6 +61,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin( @"Speed.Cd have increased their security. If you are having problems please check the security tab in your Speed.Cd profile. Eg. Geo Locking, your seedbox may be in a different country to the one where you login via your diff --git a/src/Jackett.Common/Indexers/SuperBits.cs b/src/Jackett.Common/Indexers/SuperBits.cs index 73e26c0c9..8217c5eb6 100644 --- a/src/Jackett.Common/Indexers/SuperBits.cs +++ b/src/Jackett.Common/Indexers/SuperBits.cs @@ -29,7 +29,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public SuperBits(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public SuperBits(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "superbits", name: "Superbits", description: "Superbits is a SWEDISH Private Torrent Tracker for MOVIES / TV / GENERAL", @@ -57,6 +58,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataCookie()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/TVStore.cs b/src/Jackett.Common/Indexers/TVStore.cs index 095852494..eec8df26b 100644 --- a/src/Jackett.Common/Indexers/TVStore.cs +++ b/src/Jackett.Common/Indexers/TVStore.cs @@ -31,7 +31,8 @@ namespace Jackett.Common.Indexers private readonly Regex _seriesInfoSearchRegex = new Regex( @"S(?\d{1,3})(?:E(?\d{1,3}))?$", RegexOptions.IgnoreCase); - public TVStore(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) : + public TVStore(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "tvstore", name: "TV Store", description: "TV Store is a HUNGARIAN Private Torrent Tracker for TV", @@ -51,6 +52,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataTVstore()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/TVVault.cs b/src/Jackett.Common/Indexers/TVVault.cs index 360bf5ea6..ff24ae0c9 100644 --- a/src/Jackett.Common/Indexers/TVVault.cs +++ b/src/Jackett.Common/Indexers/TVVault.cs @@ -27,7 +27,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; - public TVVault(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public TVVault(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "tvvault", name: "TV-Vault", description: "A TV tracker for old shows", @@ -47,6 +48,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/ThePirateBay.cs b/src/Jackett.Common/Indexers/ThePirateBay.cs index a6133f290..396fc908f 100644 --- a/src/Jackett.Common/Indexers/ThePirateBay.cs +++ b/src/Jackett.Common/Indexers/ThePirateBay.cs @@ -55,12 +55,8 @@ namespace Jackett.Common.Indexers private static readonly Uri _ApiBaseUri = new Uri("https://apibay.org/"); - public ThePirateBay( - IIndexerConfigurationService configService, - WebClient client, - Logger logger, - IProtectionService p - ) : base( + public ThePirateBay(IIndexerConfigurationService configService, WebClient client, Logger logger, + IProtectionService ps, ICacheService cs) : base( id: "thepiratebay", name: "The Pirate Bay", description: "Pirate Bay (TPB) is the galaxy’s most resilient Public BitTorrent site", @@ -87,7 +83,8 @@ namespace Jackett.Common.Indexers configService: configService, client: client, logger: logger, - p: p, + p: ps, + cacheService: cs, configData: new ConfigurationData() ) { diff --git a/src/Jackett.Common/Indexers/Toloka.cs b/src/Jackett.Common/Indexers/Toloka.cs index 4e8a2a86e..4477a16c4 100644 --- a/src/Jackett.Common/Indexers/Toloka.cs +++ b/src/Jackett.Common/Indexers/Toloka.cs @@ -31,7 +31,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public Toloka(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public Toloka(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "toloka", name: "Toloka.to", description: "Toloka is a Semi-Private Ukrainian torrent site with a thriving file-sharing community", @@ -59,6 +60,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataToloka()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/TorrenTech.cs b/src/Jackett.Common/Indexers/TorrenTech.cs index 5cb42cb12..25f579bd3 100644 --- a/src/Jackett.Common/Indexers/TorrenTech.cs +++ b/src/Jackett.Common/Indexers/TorrenTech.cs @@ -31,7 +31,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public TorrenTech(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) + public TorrenTech(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "torrentech", name: "Torrentech", description: "Torrentech (TTH) is a Private Torrent Tracker for ELECTRONIC MUSIC", @@ -47,6 +48,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithRSSAndDisplay()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/TorrentBytes.cs b/src/Jackett.Common/Indexers/TorrentBytes.cs index 7e67c0137..e5430fb9e 100644 --- a/src/Jackett.Common/Indexers/TorrentBytes.cs +++ b/src/Jackett.Common/Indexers/TorrentBytes.cs @@ -24,7 +24,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; - public TorrentBytes(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public TorrentBytes(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "torrentbytes", name: "TorrentBytes", description: "A decade of TorrentBytes", @@ -48,6 +49,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin("For best results, change the 'Torrents per page' setting to 100 in your profile on the TorrentBytes webpage.")) { Encoding = Encoding.GetEncoding("iso-8859-1"); diff --git a/src/Jackett.Common/Indexers/TorrentDay.cs b/src/Jackett.Common/Indexers/TorrentDay.cs index 28773932e..bf4ecd562 100644 --- a/src/Jackett.Common/Indexers/TorrentDay.cs +++ b/src/Jackett.Common/Indexers/TorrentDay.cs @@ -46,7 +46,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataCookie configData => (ConfigurationDataCookie)base.configData; - public TorrentDay(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public TorrentDay(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "torrentday", name: "TorrentDay", description: "TorrentDay (TD) is a Private site for TV / MOVIES / GENERAL", @@ -74,6 +75,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataCookie( "Make sure you get the cookies from the same torrent day domain as configured above.")) { diff --git a/src/Jackett.Common/Indexers/TorrentHeaven.cs b/src/Jackett.Common/Indexers/TorrentHeaven.cs index e50c64bd7..4c48cb382 100644 --- a/src/Jackett.Common/Indexers/TorrentHeaven.cs +++ b/src/Jackett.Common/Indexers/TorrentHeaven.cs @@ -20,35 +20,37 @@ namespace Jackett.Common.Indexers [ExcludeFromCodeCoverage] public class TorrentHeaven : BaseWebIndexer { - public TorrentHeaven(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) : - base(id: "torrentheaven", - name: "TorrentHeaven", - description: "A German general tracker.", - link: "https://newheaven.nl/", - caps: new TorznabCapabilities - { - TvSearchParams = new List - { - TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep - }, - MovieSearchParams = new List - { - MovieSearchParam.Q - }, - MusicSearchParams = new List - { - MusicSearchParam.Q - }, - BookSearchParams = new List - { - BookSearchParam.Q - } - }, - configService: configService, - client: wc, - logger: l, - p: ps, - configData: new ConfigurationDataCaptchaLogin()) + public TorrentHeaven(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) + : base(id: "torrentheaven", + name: "TorrentHeaven", + description: "A German general tracker.", + link: "https://newheaven.nl/", + caps: new TorznabCapabilities + { + TvSearchParams = new List + { + TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep + }, + MovieSearchParams = new List + { + MovieSearchParam.Q + }, + MusicSearchParams = new List + { + MusicSearchParam.Q + }, + BookSearchParams = new List + { + BookSearchParam.Q + } + }, + configService: configService, + client: wc, + logger: l, + p: ps, + cacheService: cs, + configData: new ConfigurationDataCaptchaLogin()) { Encoding = Encoding.GetEncoding("iso-8859-1"); Language = "de-de"; diff --git a/src/Jackett.Common/Indexers/TorrentLeech.cs b/src/Jackett.Common/Indexers/TorrentLeech.cs index 68f076065..736120511 100644 --- a/src/Jackett.Common/Indexers/TorrentLeech.cs +++ b/src/Jackett.Common/Indexers/TorrentLeech.cs @@ -30,7 +30,8 @@ namespace Jackett.Common.Indexers "https://v4.torrentleech.org/" }; - public TorrentLeech(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) + public TorrentLeech(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "torrentleech", name: "TorrentLeech", description: "This is what happens when you seed", @@ -58,6 +59,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin( "For best results, change the 'Default Number of Torrents per Page' setting to 100 in your Profile.")) { diff --git a/src/Jackett.Common/Indexers/TorrentMafya.cs b/src/Jackett.Common/Indexers/TorrentMafya.cs index ac0d3211a..d7297ca05 100644 --- a/src/Jackett.Common/Indexers/TorrentMafya.cs +++ b/src/Jackett.Common/Indexers/TorrentMafya.cs @@ -30,7 +30,8 @@ namespace Jackett.Common.Indexers public IEnumerable aaData { get; set; } } - public TorrentMafya(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public TorrentMafya(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "torrentmafya", name: "TorrentMafya", description: "TorrentMafya is a Turkish general torrent tracker ", @@ -49,6 +50,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/TorrentNetwork.cs b/src/Jackett.Common/Indexers/TorrentNetwork.cs index 457d13eb0..d18930a9d 100644 --- a/src/Jackett.Common/Indexers/TorrentNetwork.cs +++ b/src/Jackett.Common/Indexers/TorrentNetwork.cs @@ -33,7 +33,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public TorrentNetwork(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public TorrentNetwork(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "torrentnetwork", name: "Torrent Network", description: "Torrent Network (TN) is a GERMAN Private site for TV / MOVIES / GENERAL", @@ -61,6 +62,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithRSSAndDisplay()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/TorrentSeeds.cs b/src/Jackett.Common/Indexers/TorrentSeeds.cs index dec391563..e54854a12 100644 --- a/src/Jackett.Common/Indexers/TorrentSeeds.cs +++ b/src/Jackett.Common/Indexers/TorrentSeeds.cs @@ -27,35 +27,37 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLoginWithRSSAndDisplay configData => (ConfigurationDataBasicLoginWithRSSAndDisplay)base.configData; - public TorrentSeeds(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, IProtectionService ps) : - base(id: "torrentseeds", - name: "TorrentSeeds", - description: "TorrentSeeds is a Private site for MOVIES / TV / GENERAL", - link: "https://torrentseeds.org/", - caps: new TorznabCapabilities - { - TvSearchParams = new List - { - TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep - }, - MovieSearchParams = new List - { + public TorrentSeeds(IIndexerConfigurationService configService, Utils.Clients.WebClient wc, Logger l, + IProtectionService ps, ICacheService cs) + : base(id: "torrentseeds", + name: "TorrentSeeds", + description: "TorrentSeeds is a Private site for MOVIES / TV / GENERAL", + link: "https://torrentseeds.org/", + caps: new TorznabCapabilities + { + TvSearchParams = new List + { + TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep + }, + MovieSearchParams = new List + { MovieSearchParam.Q - }, - MusicSearchParams = new List - { - MusicSearchParam.Q - }, - BookSearchParams = new List - { - BookSearchParam.Q - } - }, - configService: configService, - client: wc, - logger: l, - p: ps, - configData: new ConfigurationDataBasicLoginWithRSSAndDisplay("For best results, change the Torrents per page: setting to 100 on your account profile.")) + }, + MusicSearchParams = new List + { + MusicSearchParam.Q + }, + BookSearchParams = new List + { + BookSearchParam.Q + } + }, + configService: configService, + client: wc, + logger: l, + p: ps, + cacheService: cs, + configData: new ConfigurationDataBasicLoginWithRSSAndDisplay("For best results, change the Torrents per page: setting to 100 on your account profile.")) { Encoding = Encoding.UTF8; Language = "en-us"; diff --git a/src/Jackett.Common/Indexers/TorrentSyndikat.cs b/src/Jackett.Common/Indexers/TorrentSyndikat.cs index db71bca02..f9fca1d59 100644 --- a/src/Jackett.Common/Indexers/TorrentSyndikat.cs +++ b/src/Jackett.Common/Indexers/TorrentSyndikat.cs @@ -28,7 +28,8 @@ namespace Jackett.Common.Indexers set => configData = value; } - public TorrentSyndikat(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) + public TorrentSyndikat(IIndexerConfigurationService configService, WebClient w, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "torrentsyndikat", name: "Torrent-Syndikat", description: "A German general tracker", @@ -56,6 +57,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataAPIKey()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/TorrentsCSV.cs b/src/Jackett.Common/Indexers/TorrentsCSV.cs index 61a5f2d59..afcf7f9fc 100644 --- a/src/Jackett.Common/Indexers/TorrentsCSV.cs +++ b/src/Jackett.Common/Indexers/TorrentsCSV.cs @@ -22,7 +22,8 @@ namespace Jackett.Common.Indexers private new ConfigurationData configData => base.configData; - public TorrentsCSV(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public TorrentsCSV(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "torrentscsv", name: "Torrents.csv", description: "Torrents.csv is a self-hostable, open source torrent search engine and database", @@ -42,6 +43,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/XSpeeds.cs b/src/Jackett.Common/Indexers/XSpeeds.cs index 1e624b3f0..3ec1b5a75 100644 --- a/src/Jackett.Common/Indexers/XSpeeds.cs +++ b/src/Jackett.Common/Indexers/XSpeeds.cs @@ -29,7 +29,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLoginWithRSSAndDisplay configData => (ConfigurationDataBasicLoginWithRSSAndDisplay)base.configData; - public XSpeeds(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public XSpeeds(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "xspeeds", name: "XSpeeds", description: "XSpeeds (XS) is a Private Torrent Tracker for MOVIES / TV / GENERAL", @@ -53,6 +54,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLoginWithRSSAndDisplay()) { Encoding = Encoding.UTF8; diff --git a/src/Jackett.Common/Indexers/Xthor.cs b/src/Jackett.Common/Indexers/Xthor.cs index 75b50a70a..1ab3ad45f 100644 --- a/src/Jackett.Common/Indexers/Xthor.cs +++ b/src/Jackett.Common/Indexers/Xthor.cs @@ -40,7 +40,8 @@ namespace Jackett.Common.Indexers public Dictionary EmulatedBrowserHeaders { get; } = new Dictionary(); private ConfigurationDataXthor ConfigData => (ConfigurationDataXthor)configData; - public Xthor(IIndexerConfigurationService configService, Utils.Clients.WebClient w, Logger l, IProtectionService ps) + public Xthor(IIndexerConfigurationService configService, Utils.Clients.WebClient w, Logger l, + IProtectionService ps, ICacheService cs) : base(id: "xthor", name: "Xthor", description: "General French Private Tracker", @@ -68,6 +69,7 @@ namespace Jackett.Common.Indexers client: w, logger: l, p: ps, + cacheService: cs, downloadBase: "https://xthor.tk/download.php?torrent=", configData: new ConfigurationDataXthor()) { diff --git a/src/Jackett.Common/Indexers/YTS.cs b/src/Jackett.Common/Indexers/YTS.cs index 3435d8419..212d46544 100644 --- a/src/Jackett.Common/Indexers/YTS.cs +++ b/src/Jackett.Common/Indexers/YTS.cs @@ -33,7 +33,8 @@ namespace Jackett.Common.Indexers set => base.configData = value; } - public YTS(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public YTS(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "yts", name: "YTS", description: "YTS is a Public torrent site specialising in HD movies of small size", @@ -46,6 +47,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationData()) { Encoding = Encoding.GetEncoding("windows-1252"); diff --git a/src/Jackett.Common/Indexers/ZonaQ.cs b/src/Jackett.Common/Indexers/ZonaQ.cs index fa465442a..50c203d2e 100644 --- a/src/Jackett.Common/Indexers/ZonaQ.cs +++ b/src/Jackett.Common/Indexers/ZonaQ.cs @@ -32,7 +32,8 @@ namespace Jackett.Common.Indexers private new ConfigurationDataBasicLogin configData => (ConfigurationDataBasicLogin)base.configData; - public ZonaQ(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) + public ZonaQ(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps, + ICacheService cs) : base(id: "zonaq", name: "ZonaQ", description: "ZonaQ is a SPANISH Private Torrent Tracker for MOVIES / TV", @@ -52,6 +53,7 @@ namespace Jackett.Common.Indexers client: wc, logger: l, p: ps, + cacheService: cs, configData: new ConfigurationDataBasicLogin("For best results, change the 'Torrents por página' option to 100 in 'Mi Panel' page.")) { diff --git a/src/Jackett.Common/Models/CachedResult.cs b/src/Jackett.Common/Models/CachedResult.cs deleted file mode 100644 index e105b4a35..000000000 --- a/src/Jackett.Common/Models/CachedResult.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Jackett.Common.Models -{ - public class CachedResult - { - public ReleaseInfo Result - { - set; get; - } - - public DateTime Created - { - set; get; - } - } -} diff --git a/src/Jackett.Common/Models/Config/ServerConfig.cs b/src/Jackett.Common/Models/Config/ServerConfig.cs index 6faccdbdc..11c3bebd7 100644 --- a/src/Jackett.Common/Models/Config/ServerConfig.cs +++ b/src/Jackett.Common/Models/Config/ServerConfig.cs @@ -13,8 +13,13 @@ namespace Jackett.Common.Models.Config public ServerConfig(RuntimeSettings runtimeSettings) { observers = new List>(); + // Default values Port = 9117; - AllowExternal = System.Environment.OSVersion.Platform == PlatformID.Unix; + AllowExternal = Environment.OSVersion.Platform == PlatformID.Unix; + CacheEnabled = true; + // Sonarr 15min, Radarr 60min, LazyLibrarian 20min, Readarr 15min, Lidarr = 15min + CacheTtl = 2100; // 35 minutes is a reasonable value for all of them and to avoid race conditions + CacheMaxResultsPerIndexer = 1000; RuntimeSettings = runtimeSettings; } @@ -34,6 +39,9 @@ namespace Jackett.Common.Models.Config public bool UpdateDisabled { get; set; } public bool UpdatePrerelease { get; set; } public string BasePathOverride { get; set; } + public bool CacheEnabled { get; set; } + public long CacheTtl { get; set; } + public long CacheMaxResultsPerIndexer { get; set; } public string OmdbApiKey { get; set; } public string OmdbApiUrl { get; set; } diff --git a/src/Jackett.Common/Models/DTO/ServerConfig.cs b/src/Jackett.Common/Models/DTO/ServerConfig.cs index 2141d7127..2e935a259 100644 --- a/src/Jackett.Common/Models/DTO/ServerConfig.cs +++ b/src/Jackett.Common/Models/DTO/ServerConfig.cs @@ -28,6 +28,12 @@ namespace Jackett.Common.Models.DTO [DataMember] public string basepathoverride { get; set; } [DataMember] + public bool cache_enabled { get; set; } + [DataMember] + public long cache_ttl { get; set; } + [DataMember] + public long cache_max_results_per_indexer { get; set; } + [DataMember] public string omdbkey { get; set; } [DataMember] public string omdburl { get; set; } @@ -61,6 +67,9 @@ namespace Jackett.Common.Models.DTO password = string.IsNullOrEmpty(config.AdminPassword) ? string.Empty : config.AdminPassword.Substring(0, 10); logging = config.RuntimeSettings.TracingEnabled; basepathoverride = config.BasePathOverride; + cache_enabled = config.CacheEnabled; + cache_ttl = config.CacheTtl; + cache_max_results_per_indexer = config.CacheMaxResultsPerIndexer; omdbkey = config.OmdbApiKey; omdburl = config.OmdbApiUrl; app_version = version; diff --git a/src/Jackett.Common/Models/TrackerCache.cs b/src/Jackett.Common/Models/TrackerCache.cs index 03fcc90b1..ab3ef47ab 100644 --- a/src/Jackett.Common/Models/TrackerCache.cs +++ b/src/Jackett.Common/Models/TrackerCache.cs @@ -1,3 +1,4 @@ + using System.Collections.Generic; namespace Jackett.Common.Models @@ -6,7 +7,6 @@ namespace Jackett.Common.Models { public string TrackerId { set; get; } public string TrackerName { set; get; } - - public List Results = new List(); + public Dictionary Queries = new Dictionary(); } } diff --git a/src/Jackett.Common/Models/TrackerCacheQuery.cs b/src/Jackett.Common/Models/TrackerCacheQuery.cs new file mode 100644 index 000000000..921c11c6f --- /dev/null +++ b/src/Jackett.Common/Models/TrackerCacheQuery.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Jackett.Common.Models +{ + internal class TrackerCacheQuery + { + public DateTime Created + { + set; get; + } + + public List Results = new List(); + } +} diff --git a/src/Jackett.Common/Services/CacheService.cs b/src/Jackett.Common/Services/CacheService.cs index eb753a9a8..c05f46dad 100644 --- a/src/Jackett.Common/Services/CacheService.cs +++ b/src/Jackett.Common/Services/CacheService.cs @@ -1,104 +1,235 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Security.Cryptography; +using System.Text; using AutoMapper; using Jackett.Common.Indexers; using Jackett.Common.Models; +using Jackett.Common.Models.Config; using Jackett.Common.Services.Interfaces; +using Jint.Parser; +using NLog; namespace Jackett.Common.Services { - + /// + /// This service is in charge of Jackett cache. In simple words, when you make a request in Jackett, the results are + /// saved in memory (cache). The next request will return results form the cache improving response time and making + /// fewer requests to the sites. + /// * We assume all indexers/sites are stateless, the same request return the same response. If you change the + /// search term, categories or something in the query Jackett has to make a live request to the indexer. + /// * There are some situations when we don't want to use the cache: + /// * When we are testing the indexers => if query.IsTest results are not cached + /// * When the user updates the configuration of one indexer => We call CleanIndexerCache to remove cached results + /// before testing the configuration + /// * When there is some error/exception in the indexer => The results are not cached so we can retry in the + /// next request + /// * We want to limit the memory usage, so we try to remove elements from cache ASAP: + /// * Each indexer can have a maximum number of results in memory. If the limit is exceeded we remove old results + /// * Cached results expire after some time + /// * Users can configure the cache or even disable it + /// public class CacheService : ICacheService { - private readonly List cache = new List(); - private readonly int MAX_RESULTS_PER_TRACKER = 1000; - private readonly TimeSpan AGE_LIMIT = new TimeSpan(0, 1, 0, 0); + private readonly Logger _logger; + private readonly ServerConfig _serverConfig; + private readonly SHA256Managed _sha256 = new SHA256Managed(); + private readonly Dictionary _cache = new Dictionary(); - public void CacheRssResults(IIndexer indexer, IEnumerable releases) + public CacheService(Logger logger, ServerConfig serverConfig) { - lock (cache) + _logger = logger; + _serverConfig = serverConfig; + } + + public void CacheResults(IIndexer indexer, TorznabQuery query, List releases) + { + // do not cache test queries! + if (query.IsTest) + return; + + lock (_cache) { - var trackerCache = cache.FirstOrDefault(c => c.TrackerId == indexer.Id); - if (trackerCache == null) + if (!IsCacheEnabled()) + return; + + if (!_cache.ContainsKey(indexer.Id)) { - trackerCache = new TrackerCache + _cache.Add(indexer.Id, new TrackerCache { TrackerId = indexer.Id, TrackerName = indexer.DisplayName - }; - cache.Add(trackerCache); + }); } - foreach (var release in releases.OrderByDescending(i => i.PublishDate)) + var trackerCacheQuery = new TrackerCacheQuery { - var existingItem = trackerCache.Results.FirstOrDefault(i => i.Result.Guid == release.Guid); - if (existingItem == null) - { - existingItem = new CachedResult - { - Created = DateTime.Now - }; - trackerCache.Results.Add(existingItem); - } + Created = DateTime.Now, + Results = releases + }; - existingItem.Result = release; - } + var trackerCache = _cache[indexer.Id]; + var queryHash = GetQueryHash(query); + if (trackerCache.Queries.ContainsKey(queryHash)) + trackerCache.Queries[queryHash] = trackerCacheQuery; // should not happen, just in case + else + trackerCache.Queries.Add(queryHash, trackerCacheQuery); - // Prune cache - foreach (var tracker in cache) - { - tracker.Results = tracker.Results.Where(x => x.Created > DateTime.Now.Subtract(AGE_LIMIT)).OrderByDescending(i => i.Created).Take(MAX_RESULTS_PER_TRACKER).ToList(); - } + _logger.Debug($"CACHE CacheResults / Indexer: {trackerCache.TrackerId} / Added: {releases.Count} releases"); + + PruneCacheByMaxResultsPerIndexer(); // remove old results if we exceed the maximum limit } } - public int GetNewItemCount(IIndexer indexer, IEnumerable releases) + public List Search(IIndexer indexer, TorznabQuery query) { - lock (cache) + lock (_cache) { - var newItemCount = 0; - var trackerCache = cache.FirstOrDefault(c => c.TrackerId == indexer.Id); - if (trackerCache != null) - { - foreach (var release in releases) - { - if (trackerCache.Results.Count(i => i.Result.Guid == release.Guid) == 0) - { - newItemCount++; - } - } - } - else - { - newItemCount++; - } + if (!IsCacheEnabled()) + return null; - return newItemCount; + PruneCacheByTtl(); // remove expired results + + if (!_cache.ContainsKey(indexer.Id)) + return null; + + var trackerCache = _cache[indexer.Id]; + var queryHash = GetQueryHash(query); + if (!trackerCache.Queries.ContainsKey(queryHash)) + return null; + + var releases = trackerCache.Queries[queryHash].Results; + _logger.Debug($"CACHE Search / Indexer: {trackerCache.TrackerId} / Found: {releases.Count} releases"); + + return releases; } } public List GetCachedResults() { - lock (cache) + lock (_cache) { + if (!IsCacheEnabled()) + return new List(); + + PruneCacheByTtl(); // remove expired results + var results = new List(); - - foreach (var tracker in cache) + foreach (var trackerCache in _cache.Values) { - foreach (var release in tracker.Results.OrderByDescending(i => i.Result.PublishDate).Take(300)) + var trackerResults = new List(); + foreach (var query in trackerCache.Queries.Values.OrderByDescending(q => q.Created)) // newest first { - var item = Mapper.Map(release.Result); - item.FirstSeen = release.Created; - item.Tracker = tracker.TrackerName; - item.TrackerId = tracker.TrackerId; - item.Peers = item.Peers - item.Seeders; // Use peers as leechers - results.Add(item); + foreach (var release in query.Results) + { + var item = Mapper.Map(release); + item.FirstSeen = query.Created; + item.Tracker = trackerCache.TrackerName; + item.TrackerId = trackerCache.TrackerId; + item.Peers -= item.Seeders; // Use peers as leechers + trackerResults.Add(item); + } } + trackerResults = trackerResults.GroupBy(r => r.Guid).Select(y => y.First()).Take(300).ToList(); + results.AddRange(trackerResults); } + var result = results.OrderByDescending(i => i.PublishDate).Take(3000).ToList(); - return results.Take(3000).OrderByDescending(i => i.PublishDate).ToList(); + _logger.Debug($"CACHE GetCachedResults / Results: {result.Count} (cache may contain more results)"); + PrintCacheStatus(); + + return result; } } + + public void CleanIndexerCache(IIndexer indexer) + { + lock (_cache) + { + if (!IsCacheEnabled()) + return; + + if (_cache.ContainsKey(indexer.Id)) + _cache.Remove(indexer.Id); + + _logger.Debug($"CACHE CleanIndexerCache / Indexer: {indexer.Id}"); + + PruneCacheByTtl(); // remove expired results + } + } + + private bool IsCacheEnabled() + { + if (!_serverConfig.CacheEnabled) + { + // remove cached results just in case user disabled cache recently + _cache.Clear(); + _logger.Debug("CACHE IsCacheEnabled => false"); + } + return _serverConfig.CacheEnabled; + } + + private void PruneCacheByTtl() + { + var prunedCounter = 0; + var expirationDate = DateTime.Now.AddSeconds(-_serverConfig.CacheTtl); + foreach (var trackerCache in _cache.Values) + { + // Remove expired queries + var queriesToRemove = trackerCache.Queries + .Where(q => q.Value.Created < expirationDate) + .Select(q => q.Key).ToList(); + foreach (var queryHash in queriesToRemove) + trackerCache.Queries.Remove(queryHash); + prunedCounter += queriesToRemove.Count; + } + if (_logger.IsDebugEnabled) + { + _logger.Debug($"CACHE PruneCacheByTtl / Pruned queries: {prunedCounter}"); + PrintCacheStatus(); + } + } + + private void PruneCacheByMaxResultsPerIndexer() + { + var prunedCounter = 0; + foreach (var trackerCache in _cache.Values) + { + // Remove queries exceeding max results per indexer + var resultsPerQuery = trackerCache.Queries + .OrderByDescending(q => q.Value.Created) // newest first + .Select(q => new Tuple(q.Key, q.Value.Results.Count)).ToList(); + while (true) + { + var total = resultsPerQuery.Select(q => q.Item2).Sum(); + if (total <= _serverConfig.CacheMaxResultsPerIndexer) + break; + trackerCache.Queries.Remove(resultsPerQuery.Pop().Item1); // remove the older + prunedCounter++; + } + } + if (_logger.IsDebugEnabled) + { + _logger.Debug($"CACHE PruneCacheByMaxResultsPerIndexer / Pruned queries: {prunedCounter}"); + PrintCacheStatus(); + } + } + + private string GetQueryHash(TorznabQuery query) + { + var json = Newtonsoft.Json.JsonConvert.SerializeObject(query); + _logger.Debug($"CACHE Request query: {json}"); + // Changes in the query to improve cache hits + // Both request must return the same results, if not we are breaking Jackett search + json = json.Replace("\"SearchTerm\":null", "\"SearchTerm\":\"\""); + // Compute the hash + return BitConverter.ToString(_sha256.ComputeHash(Encoding.ASCII.GetBytes(json))); + } + + private void PrintCacheStatus() + { + _logger.Debug($"CACHE Status / Total cached results: {_cache.Values.SelectMany(tc => tc.Queries).Select(q => q.Value.Results.Count).Sum()}"); + } } } diff --git a/src/Jackett.Common/Services/IndexerManagerService.cs b/src/Jackett.Common/Services/IndexerManagerService.cs index 57aa0d34c..fec9150f6 100644 --- a/src/Jackett.Common/Services/IndexerManagerService.cs +++ b/src/Jackett.Common/Services/IndexerManagerService.cs @@ -114,14 +114,14 @@ namespace Jackett.Common.Services var indexerTypes = allNonMetaInstantiatableIndexerTypes.Where(p => p.Name != "CardigannIndexer"); var nativeIndexers = indexerTypes.Select(type => { - var constructorArgumentTypes = new [] { typeof(IIndexerConfigurationService), typeof(WebClient), typeof(Logger), typeof(IProtectionService) }; + var constructorArgumentTypes = new [] { typeof(IIndexerConfigurationService), typeof(WebClient), typeof(Logger), typeof(IProtectionService), typeof(ICacheService) }; var constructor = type.GetConstructor(constructorArgumentTypes); if (constructor != null) { // create own webClient instance for each indexer (separate cookies stores, etc.) var indexerWebClientInstance = (WebClient)Activator.CreateInstance(webClient.GetType(), processService, logger, globalConfigService, serverConfig); - var arguments = new object[] { configService, indexerWebClientInstance, logger, protectionService }; + var arguments = new object[] { configService, indexerWebClientInstance, logger, protectionService, cacheService }; var indexer = (IIndexer)constructor.Invoke(arguments); return indexer; } @@ -176,7 +176,7 @@ namespace Jackett.Common.Services // create own webClient instance for each indexer (seperate cookies stores, etc.) var indexerWebClientInstance = (WebClient)Activator.CreateInstance(webClient.GetType(), processService, logger, globalConfigService, serverConfig); - IIndexer indexer = new CardigannIndexer(configService, indexerWebClientInstance, logger, protectionService, definition); + IIndexer indexer = new CardigannIndexer(configService, indexerWebClientInstance, logger, protectionService, cacheService, definition); configService.Load(indexer); return indexer; } @@ -229,7 +229,7 @@ namespace Jackett.Common.Services } logger.Info("Adding aggregate indexer ('all' indexer) ..."); - aggregateIndexer = new AggregateIndexer(fallbackStrategyProvider, resultFilterProvider, configService, webClient, logger, protectionService) + aggregateIndexer = new AggregateIndexer(fallbackStrategyProvider, resultFilterProvider, configService, webClient, logger, protectionService, cacheService) { Indexers = indexers.Values }; @@ -291,17 +291,18 @@ namespace Jackett.Common.Services public async Task TestIndexer(string name) { var indexer = GetIndexer(name); - var browseQuery = new TorznabQuery + var query = new TorznabQuery { QueryType = "search", SearchTerm = "", IsTest = true }; - var result = await indexer.ResultsForQuery(browseQuery); - logger.Info($"Found {result.Releases.Count()} releases from {indexer.DisplayName}"); + var result = await indexer.ResultsForQuery(query); + + logger.Info($"Test search in {indexer.DisplayName} => Found {result.Releases.Count()} releases"); + if (!result.Releases.Any()) throw new Exception("Found no results while trying to browse this tracker"); - cacheService.CacheRssResults(indexer, result.Releases); } public void DeleteIndexer(string name) diff --git a/src/Jackett.Common/Services/Interfaces/ICacheService.cs b/src/Jackett.Common/Services/Interfaces/ICacheService.cs index 5e1048588..cd76b12a8 100644 --- a/src/Jackett.Common/Services/Interfaces/ICacheService.cs +++ b/src/Jackett.Common/Services/Interfaces/ICacheService.cs @@ -6,8 +6,9 @@ namespace Jackett.Common.Services.Interfaces { public interface ICacheService { - void CacheRssResults(IIndexer indexer, IEnumerable releases); + List Search(IIndexer indexer, TorznabQuery query); + void CacheResults(IIndexer indexer, TorznabQuery query, List releases); List GetCachedResults(); - int GetNewItemCount(IIndexer indexer, IEnumerable releases); + void CleanIndexerCache(IIndexer indexer); } } diff --git a/src/Jackett.Server/Controllers/IndexerApiController.cs b/src/Jackett.Server/Controllers/IndexerApiController.cs index b55ea3d17..2aee70154 100644 --- a/src/Jackett.Server/Controllers/IndexerApiController.cs +++ b/src/Jackett.Server/Controllers/IndexerApiController.cs @@ -85,6 +85,9 @@ namespace Jackett.Server.Controllers [TypeFilter(typeof(RequiresIndexer))] public async Task UpdateConfig([FromBody]Common.Models.DTO.ConfigItem[] config) { + // invalidate cache for this indexer + cacheService.CleanIndexerCache(CurrentIndexer); + try { // HACK diff --git a/src/Jackett.Server/Controllers/ResultsController.cs b/src/Jackett.Server/Controllers/ResultsController.cs index 3073094ec..271b27cc9 100644 --- a/src/Jackett.Server/Controllers/ResultsController.cs +++ b/src/Jackett.Server/Controllers/ResultsController.cs @@ -271,7 +271,6 @@ namespace Jackett.Server.Controllers { var searchResults = t.Result.Releases; var indexer = t.Result.Indexer; - cacheService.CacheRssResults(indexer, searchResults); return searchResults.Select(result => { @@ -279,14 +278,20 @@ namespace Jackett.Server.Controllers item.Tracker = indexer.DisplayName; item.TrackerId = indexer.Id; item.Peers = item.Peers - item.Seeders; // Use peers as leechers - return item; }); }).OrderByDescending(d => d.PublishDate).ToList(); ConfigureCacheResults(manualResult.Results); - logger.Info(string.Format("Manual search for \"{0}\" on {1} with {2} results.", CurrentQuery.SanitizedSearchTerm, string.Join(", ", manualResult.Indexers.Select(i => i.ID)), manualResult.Results.Count())); + // Log info + var indexersName = string.Join(", ", manualResult.Indexers.Select(i => i.ID)); + var cacheStr = tasks.Where(t => t.Status == TaskStatus.RanToCompletion).Any(t => t.Result.IsFromCache) ? " (from cache)" : ""; + if (string.IsNullOrWhiteSpace(CurrentQuery.SanitizedSearchTerm)) + logger.Info($"Manual search in {indexersName} => Found {manualResult.Results.Count()} releases{cacheStr}"); + else + logger.Info($"Manual search in {indexersName} for {CurrentQuery.GetQueryString()} => Found {manualResult.Results.Count()} releases{cacheStr}"); + return Json(manualResult); } @@ -386,33 +391,12 @@ namespace Jackett.Server.Controllers { var result = await CurrentIndexer.ResultsForQuery(CurrentQuery); - // Some trackers do not support multiple category filtering so filter the releases that match manually. - int? newItemCount = null; - - // Cache non query results - if (string.IsNullOrEmpty(CurrentQuery.SanitizedSearchTerm)) - { - newItemCount = cacheService.GetNewItemCount(CurrentIndexer, result.Releases); - cacheService.CacheRssResults(CurrentIndexer, result.Releases); - } - // Log info - var logBuilder = new StringBuilder(); - if (newItemCount != null) - { - logBuilder.AppendFormat("Found {0} ({1} new) releases from {2}", result.Releases.Count(), newItemCount, CurrentIndexer.DisplayName); - } + var cacheStr = result.IsFromCache ? " (from cache)" : ""; + if (string.IsNullOrWhiteSpace(CurrentQuery.SanitizedSearchTerm)) + logger.Info($"Torznab search in {CurrentIndexer.DisplayName} => Found {result.Releases.Count()} releases{cacheStr}"); else - { - logBuilder.AppendFormat("Found {0} releases from {1}", result.Releases.Count(), CurrentIndexer.DisplayName); - } - - if (!string.IsNullOrWhiteSpace(CurrentQuery.SanitizedSearchTerm)) - { - logBuilder.AppendFormat(" for: {0}", CurrentQuery.GetQueryString()); - } - - logger.Info(logBuilder.ToString()); + logger.Info($"Torznab search in {CurrentIndexer.DisplayName} for {CurrentQuery.GetQueryString()} => Found {result.Releases.Count()} releases{cacheStr}"); var serverUrl = serverService.GetServerUrl(Request); var resultPage = new ResultPage(new ChannelInfo @@ -501,15 +485,12 @@ namespace Jackett.Server.Controllers { var result = await CurrentIndexer.ResultsForQuery(CurrentQuery); - // Cache non query results - if (string.IsNullOrEmpty(CurrentQuery.SanitizedSearchTerm)) - cacheService.CacheRssResults(CurrentIndexer, result.Releases); - // Log info + var cacheStr = result.IsFromCache ? " (from cache)" : ""; if (string.IsNullOrWhiteSpace(CurrentQuery.SanitizedSearchTerm)) - logger.Info($"Found {result.Releases.Count()} torrentpotato releases from {CurrentIndexer.DisplayName}"); + logger.Info($"Potato search in {CurrentIndexer.DisplayName} => Found {result.Releases.Count()} releases{cacheStr}"); else - logger.Info($"Found {result.Releases.Count()} torrentpotato releases from {CurrentIndexer.DisplayName} for: {CurrentQuery.GetQueryString()}"); + logger.Info($"Potato search in {CurrentIndexer.DisplayName} for {CurrentQuery.GetQueryString()} => Found {result.Releases.Count()} releases{cacheStr}"); var serverUrl = serverService.GetServerUrl(Request); var potatoReleases = result.Releases.Where(r => r.Link != null || r.MagnetUri != null).Select(r => diff --git a/src/Jackett.Server/Controllers/ServerConfigurationController.cs b/src/Jackett.Server/Controllers/ServerConfigurationController.cs index b7f27d2a8..30edc2f79 100644 --- a/src/Jackett.Server/Controllers/ServerConfigurationController.cs +++ b/src/Jackett.Server/Controllers/ServerConfigurationController.cs @@ -88,6 +88,9 @@ namespace Jackett.Server.Controllers throw new Exception("The Base Path Override must start with a /"); } + var cacheEnabled = config.cache_enabled; + var cacheTtl = config.cache_ttl; + var cacheMaxResultsPerIndexer = config.cache_max_results_per_indexer; var omdbApiKey = config.omdbkey; var omdbApiUrl = config.omdburl; @@ -99,6 +102,10 @@ namespace Jackett.Server.Controllers serverConfig.UpdateDisabled = updateDisabled; serverConfig.UpdatePrerelease = preRelease; serverConfig.BasePathOverride = basePathOverride; + serverConfig.CacheEnabled = cacheEnabled; + serverConfig.CacheTtl = cacheTtl; + serverConfig.CacheMaxResultsPerIndexer = cacheMaxResultsPerIndexer; + serverConfig.RuntimeSettings.BasePath = serverService.BasePath(); configService.SaveConfig(serverConfig); diff --git a/src/Jackett.Server/Startup.cs b/src/Jackett.Server/Startup.cs index 297fb7e20..29f093a98 100644 --- a/src/Jackett.Server/Startup.cs +++ b/src/Jackett.Server/Startup.cs @@ -6,6 +6,7 @@ using Autofac; using Autofac.Extensions.DependencyInjection; using Jackett.Common.Models.Config; using Jackett.Common.Plumbing; +using Jackett.Common.Services; using Jackett.Common.Services.Interfaces; using Jackett.Server.Middleware; using Jackett.Server.Services; @@ -87,6 +88,7 @@ namespace Jackett.Server builder.RegisterType().As().SingleInstance(); builder.RegisterType().As().SingleInstance(); builder.RegisterType().As().SingleInstance(); + builder.RegisterType().As().SingleInstance(); builder.RegisterType().As().SingleInstance(); builder.RegisterType().As().SingleInstance(); diff --git a/src/Jackett.Test/Common/Indexers/CardigannIndexerTests.cs b/src/Jackett.Test/Common/Indexers/CardigannIndexerTests.cs index 2a2e20868..4b161e8d2 100644 --- a/src/Jackett.Test/Common/Indexers/CardigannIndexerTests.cs +++ b/src/Jackett.Test/Common/Indexers/CardigannIndexerTests.cs @@ -25,7 +25,7 @@ namespace Jackett.Test.Common.Indexers }, Search = new searchBlock() }; - var indexer = new CardigannIndexer(null, null, null, null, definition); + var indexer = new CardigannIndexer(null, null, null, null, null, definition); Assert.True(indexer.TorznabCaps.SearchAvailable); Assert.IsEmpty(indexer.TorznabCaps.TvSearchParams); @@ -90,7 +90,7 @@ namespace Jackett.Test.Common.Indexers }, Search = new searchBlock() }; - indexer = new CardigannIndexer(null, null, null, null, definition); + indexer = new CardigannIndexer(null, null, null, null, null, definition); // test categories var expected = new List @@ -125,7 +125,7 @@ namespace Jackett.Test.Common.Indexers }, Search = new searchBlock() }; - indexer = new CardigannIndexer(null, null, null, null, definition); + indexer = new CardigannIndexer(null, null, null, null, null, definition); Assert.True(indexer.TorznabCaps.SearchAvailable); Assert.AreEqual( diff --git a/src/Jackett.Test/Common/Models/ResultPageTests.cs b/src/Jackett.Test/Common/Models/ResultPageTests.cs index 729bbf6a0..4b0014d6a 100644 --- a/src/Jackett.Test/Common/Models/ResultPageTests.cs +++ b/src/Jackett.Test/Common/Models/ResultPageTests.cs @@ -20,7 +20,8 @@ namespace Jackett.Test.Common.Models configService: null, logger: null, configData: null, - p: null) + p: null, + cs: null) { } diff --git a/src/Jackett.Test/TestHelpers/TestWebIndexer.cs b/src/Jackett.Test/TestHelpers/TestWebIndexer.cs index 1a24f3197..6463d4c42 100644 --- a/src/Jackett.Test/TestHelpers/TestWebIndexer.cs +++ b/src/Jackett.Test/TestHelpers/TestWebIndexer.cs @@ -21,7 +21,8 @@ namespace Jackett.Test.TestHelpers configService: null, logger: null, configData: new ConfigurationData(), - p: null) + p: null, + cacheService: null) { Encoding = Encoding.UTF8; Language = "en-us";