New: Freeleech tokens support for Gazelle

pull/3170/head
ta264 3 years ago committed by Bogdan
parent 2351efd013
commit 2392573c39

@ -68,7 +68,7 @@ namespace NzbDrone.Core.Indexers.Gazelle
Container = torrent.Encoding,
Codec = torrent.Format,
Size = long.Parse(torrent.Size),
DownloadUrl = GetDownloadUrl(id, _settings.AuthKey, _settings.PassKey),
DownloadUrl = GetDownloadUrl(id),
InfoUrl = GetInfoUrl(result.GroupId, id),
Seeders = int.Parse(torrent.Seeders),
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
@ -88,14 +88,20 @@ namespace NzbDrone.Core.Indexers.Gazelle
.ToArray();
}
private string GetDownloadUrl(int torrentId, string authKey, string passKey)
private string GetDownloadUrl(int torrentId)
{
var url = new HttpUri(_settings.BaseUrl)
.CombinePath("/torrents.php")
.AddQueryParam("action", "download")
.AddQueryParam("id", torrentId)
.AddQueryParam("authkey", authKey)
.AddQueryParam("torrent_pass", passKey);
.AddQueryParam("authkey", _settings.AuthKey)
.AddQueryParam("torrent_pass", _settings.PassKey);
// Some trackers fail to download if usetoken=0 so we need to only add if we will use one
if (_settings.UseFreeleechToken)
{
url = url.AddQueryParam("usetoken", "1");
}
return url.FullUri;
}

@ -37,6 +37,9 @@ namespace NzbDrone.Core.Indexers.Gazelle
[FieldDefinition(2, Label = "Password", Type = FieldType.Password, HelpText = "Password", Privacy = PrivacyLevel.Password)]
public string Password { get; set; }
[FieldDefinition(3, Type = FieldType.Checkbox, Label = "Use Freeleech Token", HelpText = "Will cause grabbing to fail if you do not have any tokens available", Advanced = true)]
public bool UseFreeleechToken { get; set; }
[FieldDefinition(4, Type = FieldType.Number, Label = "Early Download Limit", Unit = "days", HelpText = "Time before release date Readarr will download from this indexer, empty is no limit", Advanced = true)]
public int? EarlyReleaseLimit { get; set; }

Loading…
Cancel
Save