New: Freeleech support for Redacted / Gazelle

pull/1898/head
ta264 3 years ago
parent 65647bdc58
commit 58e23c934b

@ -74,7 +74,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),
@ -92,14 +92,15 @@ 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)
.AddQueryParam("usetoken", _settings.UseFreeleechToken ? 1 : 0);
return url.FullUri;
}

@ -44,6 +44,9 @@ namespace NzbDrone.Core.Indexers.Gazelle
[FieldDefinition(5, Type = FieldType.Number, Label = "Early Download Limit", Unit = "days", HelpText = "Time before release date Lidarr will download from this indexer, empty is no limit", Advanced = true)]
public int? EarlyReleaseLimit { get; set; }
[FieldDefinition(6, 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; }
public NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));

@ -67,7 +67,7 @@ namespace NzbDrone.Core.Indexers.Redacted
Container = torrent.Encoding,
Codec = torrent.Format,
Size = long.Parse(torrent.Size),
DownloadUrl = GetDownloadUrl(id, _settings.PassKey),
DownloadUrl = GetDownloadUrl(id),
InfoUrl = GetInfoUrl(result.GroupId, id),
Seeders = int.Parse(torrent.Seeders),
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Indexers.Redacted
.ToArray();
}
private string GetDownloadUrl(int torrentId, string passKey)
private string GetDownloadUrl(int torrentId)
{
// AuthKey is required but not checked, just pass in a dummy variable
// to avoid having to track authkey, which is randomly cycled
@ -94,7 +94,8 @@ namespace NzbDrone.Core.Indexers.Redacted
.AddQueryParam("action", "download")
.AddQueryParam("id", torrentId)
.AddQueryParam("authkey", "lidarr")
.AddQueryParam("torrent_pass", passKey);
.AddQueryParam("torrent_pass", _settings.PassKey)
.AddQueryParam("usetoken", _settings.UseFreeleechToken);
return url.FullUri;
}

@ -39,6 +39,9 @@ namespace NzbDrone.Core.Indexers.Redacted
[FieldDefinition(5, Type = FieldType.Number, Label = "Early Download Limit", Unit = "days", HelpText = "Time before release date Lidarr will download from this indexer, empty is no limit", Advanced = true)]
public int? EarlyReleaseLimit { get; set; }
[FieldDefinition(6, 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; }
public NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));

Loading…
Cancel
Save