torrentnetwork: add filter freeleech. #9456

This commit is contained in:
Garfield69 2023-03-30 07:54:08 +13:00
parent 26b38d5d55
commit 78a665223f
1 changed files with 13 additions and 9 deletions

View File

@ -53,6 +53,7 @@ namespace Jackett.Common.Indexers
{
configData.AddDynamic("token", new HiddenStringConfigurationItem("token"));
configData.AddDynamic("passkey", new HiddenStringConfigurationItem("passkey"));
configData.AddDynamic("freeleech", new BoolConfigurationItem("Filter freeleech only") { Value = false });
}
private TorznabCapabilities SetCapabilities()
@ -236,6 +237,18 @@ namespace Jackett.Common.Indexers
foreach (JArray torrent in data)
{
var downloadVolumeFactor = (long)torrent[10] switch
{
// Only Up
2 => 0,
// 50 % Down
1 => 0.5,
// All others 100% down
_ => 1
};
if (((BoolConfigurationItem)configData.GetDynamic("freeleech")).Value &&
downloadVolumeFactor != 0)
continue;
var torrentID = (long)torrent[2];
var details = new Uri(SiteLink + "torrent/" + torrentID);
//var preDelaySeconds = (long)torrent[4];
@ -251,15 +264,6 @@ namespace Jackett.Common.Indexers
//var row14 = (long)torrent[14];
var link = new Uri(SiteLink + "sdownload/" + torrentID + "/" + passkey);
var publishDate = DateTimeUtil.UnixTimestampToDateTime((double)torrent[3]);
var downloadVolumeFactor = (long)torrent[10] switch
{
// Only Up
2 => 0,
// 50 % Down
1 => 0.5,
// All others 100% down
_ => 1
};
var release = new ReleaseInfo
{
MinimumRatio = 0.8,