From 1aa914986600e0a494f7752d2850cdc098887aa9 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Fri, 12 Nov 2021 13:38:23 -0600 Subject: [PATCH] Fixed: Orpheus failing to grab if token is not used Closes #592 --- .../Indexers/Definitions/Orpheus.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs b/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs index a0316a18b..6d68c8829 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs @@ -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 @@ -50,5 +51,34 @@ namespace NzbDrone.Core.Indexers.Definitions return caps; } + + public override IParseIndexerResponse GetParser() + { + return new OrpheusParser(Settings, Capabilities); + } + } + + public class OrpheusParser : GazelleParser + { + public OrpheusParser(GazelleSettings settings, IndexerCapabilities capabilities) + : base(settings, capabilities) + { + } + + protected override string GetDownloadUrl(int torrentId) + { + var url = new HttpUri(_settings.BaseUrl) + .CombinePath("/torrents.php") + .AddQueryParam("action", "download") + .AddQueryParam("id", torrentId); + + // Orpheus fails to download if usetoken=0 so we need to only add if we will use one + if (_settings.UseFreeleechToken) + { + url.AddQueryParam("useToken", "1"); + } + + return url.FullUri; + } } }