mirror of
https://github.com/Jackett/Jackett
synced 2025-03-09 21:54:51 +00:00
gazellegamesapi: support for freeleech only (#15271)
This commit is contained in:
parent
fc55a58309
commit
0737edd708
1 changed files with 24 additions and 5 deletions
|
@ -44,6 +44,7 @@ namespace Jackett.Common.Indexers
|
|||
p: ps,
|
||||
cs: cs,
|
||||
supportsFreeleechTokens: true,
|
||||
supportsFreeleechOnly: true,
|
||||
has2Fa: false,
|
||||
useApiKey: true,
|
||||
usePassKey: true,
|
||||
|
@ -236,6 +237,11 @@ namespace Jackett.Common.Indexers
|
|||
queryCollection.Add($"artistcheck[{i++}]", cat);
|
||||
}
|
||||
|
||||
if (configData.FreeleechOnly is { Value: true })
|
||||
{
|
||||
queryCollection.Set("freetorrent", "1");
|
||||
}
|
||||
|
||||
// remove . as not used in titles
|
||||
searchUrl += "?" + queryCollection.GetQueryString();
|
||||
|
||||
|
@ -268,7 +274,7 @@ namespace Jackett.Common.Indexers
|
|||
var groupId = int.Parse(gObj.Key);
|
||||
var group = gObj.Value as JObject;
|
||||
|
||||
if (group["Torrents"].Type == JTokenType.Array && group["Torrents"] is JArray array && array.Count == 0)
|
||||
if (group["Torrents"].Type == JTokenType.Array && group["Torrents"] is JArray { Count: 0 })
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -281,6 +287,18 @@ namespace Jackett.Common.Indexers
|
|||
foreach (var tObj in JObject.FromObject(group["Torrents"]))
|
||||
{
|
||||
var torrent = tObj.Value as JObject;
|
||||
|
||||
var torrentFreeTorrent = torrent.Value<string>("FreeTorrent");
|
||||
var freeTorrent = torrentFreeTorrent.IsNotNullOrWhiteSpace() && int.TryParse(torrentFreeTorrent, out var freeValue) ? freeValue : 0;
|
||||
|
||||
var downloadVolumeFactor = freeTorrent >= 1 ? 0 : 1;
|
||||
|
||||
// Skip non-freeleech results when freeleech only is set
|
||||
if (configData.FreeleechOnly is { Value: true } && downloadVolumeFactor != 0.0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var torrentId = torrent.Value<int>("ID");
|
||||
|
||||
if (categories.Length == 0)
|
||||
|
@ -335,8 +353,6 @@ namespace Jackett.Common.Indexers
|
|||
title += $" [{string.Join(", ", tags)}]";
|
||||
}
|
||||
|
||||
var torrentFreeTorrent = torrent.Value<string>("FreeTorrent");
|
||||
var freeTorrent = torrentFreeTorrent.IsNotNullOrWhiteSpace() && int.TryParse(torrentFreeTorrent, out var freeValue) ? freeValue : 0;
|
||||
|
||||
var release = new ReleaseInfo
|
||||
{
|
||||
|
@ -351,8 +367,8 @@ namespace Jackett.Common.Indexers
|
|||
Seeders = torrent.Value<int>("Seeders"),
|
||||
Peers = torrent.Value<int>("Seeders") + torrent.Value<int>("Leechers"),
|
||||
Files = torrent.Value<int>("FileCount"),
|
||||
DownloadVolumeFactor = downloadVolumeFactor,
|
||||
UploadVolumeFactor = freeTorrent >= 2 ? 0 : 1,
|
||||
DownloadVolumeFactor = freeTorrent >= 1 ? 0 : 1,
|
||||
MinimumRatio = 1,
|
||||
MinimumSeedTime = 288000, // 80 hours
|
||||
};
|
||||
|
@ -365,7 +381,10 @@ namespace Jackett.Common.Indexers
|
|||
OnParseError(response.ContentString, ex);
|
||||
}
|
||||
|
||||
return releases;
|
||||
// order by date
|
||||
return releases
|
||||
.OrderByDescending(o => o.PublishDate)
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue