mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
speedapptracker: add freeleech only (#14415)
This commit is contained in:
@@ -6,7 +6,7 @@ using System.Linq;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jackett.Common.Models;
|
using Jackett.Common.Models;
|
||||||
using Jackett.Common.Models.IndexerConfig;
|
using Jackett.Common.Models.IndexerConfig.Bespoke;
|
||||||
using Jackett.Common.Services.Interfaces;
|
using Jackett.Common.Services.Interfaces;
|
||||||
using Jackett.Common.Utils;
|
using Jackett.Common.Utils;
|
||||||
using Jackett.Common.Utils.Clients;
|
using Jackett.Common.Utils.Clients;
|
||||||
@@ -35,7 +35,7 @@ namespace Jackett.Common.Indexers.Abstract
|
|||||||
private string SearchUrl => SiteLink + "api/torrent";
|
private string SearchUrl => SiteLink + "api/torrent";
|
||||||
private string _token;
|
private string _token;
|
||||||
|
|
||||||
private new ConfigurationDataBasicLoginWithEmail configData => (ConfigurationDataBasicLoginWithEmail)base.configData;
|
private new ConfigurationDataSpeedAppTracker configData => (ConfigurationDataSpeedAppTracker)base.configData;
|
||||||
|
|
||||||
protected SpeedAppTracker(IIndexerConfigurationService configService, WebClient client, Logger logger, IProtectionService p, ICacheService cs)
|
protected SpeedAppTracker(IIndexerConfigurationService configService, WebClient client, Logger logger, IProtectionService p, ICacheService cs)
|
||||||
: base(configService: configService,
|
: base(configService: configService,
|
||||||
@@ -43,7 +43,7 @@ namespace Jackett.Common.Indexers.Abstract
|
|||||||
logger: logger,
|
logger: logger,
|
||||||
p: p,
|
p: p,
|
||||||
cacheService: cs,
|
cacheService: cs,
|
||||||
configData: new ConfigurationDataBasicLoginWithEmail())
|
configData: new ConfigurationDataSpeedAppTracker())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,8 +120,17 @@ namespace Jackett.Common.Indexers.Abstract
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var rows = JArray.Parse(response.ContentString);
|
var rows = JArray.Parse(response.ContentString);
|
||||||
|
|
||||||
foreach (var row in rows)
|
foreach (var row in rows)
|
||||||
{
|
{
|
||||||
|
var dlVolumeFactor = row.Value<double>("download_volume_factor");
|
||||||
|
|
||||||
|
// skip non-freeleech results when freeleech only is set
|
||||||
|
if (configData.FreeleechOnly.Value && dlVolumeFactor != 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var id = row.Value<string>("id");
|
var id = row.Value<string>("id");
|
||||||
var link = new Uri($"{SiteLink}api/torrent/{id}/download");
|
var link = new Uri($"{SiteLink}api/torrent/{id}/download");
|
||||||
var urlStr = row.Value<string>("url");
|
var urlStr = row.Value<string>("url");
|
||||||
@@ -141,9 +150,6 @@ namespace Jackett.Common.Indexers.Abstract
|
|||||||
var posterStr = row.Value<string>("poster");
|
var posterStr = row.Value<string>("poster");
|
||||||
var poster = Uri.TryCreate(posterStr, UriKind.Absolute, out var posterUri) ? posterUri : null;
|
var poster = Uri.TryCreate(posterStr, UriKind.Absolute, out var posterUri) ? posterUri : null;
|
||||||
|
|
||||||
var dlVolumeFactor = row.Value<double>("download_volume_factor");
|
|
||||||
var ulVolumeFactor = row.Value<double>("upload_volume_factor");
|
|
||||||
|
|
||||||
var title = row.Value<string>("name");
|
var title = row.Value<string>("name");
|
||||||
// fix for #10883
|
// fix for #10883
|
||||||
if (UseP2PReleaseName && !string.IsNullOrWhiteSpace(row.Value<string>("p2p_release_name")))
|
if (UseP2PReleaseName && !string.IsNullOrWhiteSpace(row.Value<string>("p2p_release_name")))
|
||||||
@@ -167,7 +173,7 @@ namespace Jackett.Common.Indexers.Abstract
|
|||||||
Seeders = row.Value<int>("seeders"),
|
Seeders = row.Value<int>("seeders"),
|
||||||
Peers = row.Value<int>("leechers") + row.Value<int>("seeders"),
|
Peers = row.Value<int>("leechers") + row.Value<int>("seeders"),
|
||||||
DownloadVolumeFactor = dlVolumeFactor,
|
DownloadVolumeFactor = dlVolumeFactor,
|
||||||
UploadVolumeFactor = ulVolumeFactor,
|
UploadVolumeFactor = row.Value<double>("upload_volume_factor"),
|
||||||
MinimumRatio = 1,
|
MinimumRatio = 1,
|
||||||
MinimumSeedTime = minimumSeedTime
|
MinimumSeedTime = minimumSeedTime
|
||||||
};
|
};
|
||||||
|
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace Jackett.Common.Models.IndexerConfig.Bespoke
|
||||||
|
{
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
internal class ConfigurationDataSpeedAppTracker : ConfigurationDataBasicLoginWithEmail
|
||||||
|
{
|
||||||
|
public BoolConfigurationItem FreeleechOnly { get; private set; }
|
||||||
|
|
||||||
|
public ConfigurationDataSpeedAppTracker()
|
||||||
|
{
|
||||||
|
FreeleechOnly = new BoolConfigurationItem("Show freeleech only") { Value = false };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user