Fixed: (Gazelle) Not using freeleech token correctly

Fixes #258
This commit is contained in:
Qstick
2021-06-22 21:04:23 -04:00
parent 4ec8ea0e4d
commit 4d129ada95
3 changed files with 31 additions and 7 deletions
@@ -2,6 +2,7 @@ using System.Collections.Generic;
using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Gazelle;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions
@@ -49,5 +50,29 @@ namespace NzbDrone.Core.Indexers.Definitions
return caps;
}
public override IParseIndexerResponse GetParser()
{
return new OrpheusParser(Settings, Capabilities, BaseUrl);
}
}
}
public class OrpheusParser : GazelleParser
{
public OrpheusParser(GazelleSettings settings, IndexerCapabilities capabilities, string baseUrl)
: base(settings, capabilities, baseUrl)
{
}
protected override string GetDownloadUrl(int torrentId)
{
var url = new HttpUri(_baseUrl)
.CombinePath("/ajax.php")
.AddQueryParam("action", "download")
.AddQueryParam("useToken", _settings.UseFreeleechToken ? "1" : "0")
.AddQueryParam("id", torrentId);
return url.FullUri;
}
}
}