diff --git a/src/NzbDrone.Core/Indexers/Gazelle/GazelleParser.cs b/src/NzbDrone.Core/Indexers/Gazelle/GazelleParser.cs index da0d5aaa9..42aa7758f 100644 --- a/src/NzbDrone.Core/Indexers/Gazelle/GazelleParser.cs +++ b/src/NzbDrone.Core/Indexers/Gazelle/GazelleParser.cs @@ -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; } diff --git a/src/NzbDrone.Core/Indexers/Gazelle/GazelleSettings.cs b/src/NzbDrone.Core/Indexers/Gazelle/GazelleSettings.cs index 5e4eaf88d..b9dc2e59e 100644 --- a/src/NzbDrone.Core/Indexers/Gazelle/GazelleSettings.cs +++ b/src/NzbDrone.Core/Indexers/Gazelle/GazelleSettings.cs @@ -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)); diff --git a/src/NzbDrone.Core/Indexers/Redacted/RedactedParser.cs b/src/NzbDrone.Core/Indexers/Redacted/RedactedParser.cs index ac26afd07..67b824a33 100644 --- a/src/NzbDrone.Core/Indexers/Redacted/RedactedParser.cs +++ b/src/NzbDrone.Core/Indexers/Redacted/RedactedParser.cs @@ -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; } diff --git a/src/NzbDrone.Core/Indexers/Redacted/RedactedSettings.cs b/src/NzbDrone.Core/Indexers/Redacted/RedactedSettings.cs index a89634401..468959149 100644 --- a/src/NzbDrone.Core/Indexers/Redacted/RedactedSettings.cs +++ b/src/NzbDrone.Core/Indexers/Redacted/RedactedSettings.cs @@ -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));