Support for Gazelle Indexers (RED, AR)

This commit is contained in:
Qstick
2021-02-14 00:47:21 -05:00
parent 0fb7168669
commit 30367b53fd
71 changed files with 1196 additions and 1933 deletions
@@ -9,6 +9,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
public class PassThePopcorn : HttpIndexerBase<PassThePopcornSettings>
{
public override string Name => "PassThePopcorn";
public override string BaseUrl => "https://passthepopcorn.me";
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override bool SupportsRss => true;
@@ -34,6 +35,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
Settings = Settings,
HttpClient = _httpClient,
Logger = _logger,
BaseUrl = BaseUrl
};
}
@@ -70,7 +72,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
public override IParseIndexerResponse GetParser()
{
return new PassThePopcornParser(Settings, _logger);
return new PassThePopcornParser(BaseUrl, _logger);
}
}
}
@@ -12,11 +12,11 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
{
public class PassThePopcornParser : IParseIndexerResponse
{
private readonly PassThePopcornSettings _settings;
private readonly string _baseUrl;
private readonly Logger _logger;
public PassThePopcornParser(PassThePopcornSettings settings, Logger logger)
public PassThePopcornParser(string baseUrl, Logger logger)
{
_settings = settings;
_baseUrl = baseUrl;
_logger = logger;
}
@@ -129,7 +129,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
private string GetDownloadUrl(int torrentId, string authKey, string passKey)
{
var url = new HttpUri(_settings.BaseUrl)
var url = new HttpUri(_baseUrl)
.CombinePath("/torrents.php")
.AddQueryParam("action", "download")
.AddQueryParam("id", torrentId)
@@ -141,7 +141,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
private string GetInfoUrl(string groupId, int torrentId)
{
var url = new HttpUri(_settings.BaseUrl)
var url = new HttpUri(_baseUrl)
.CombinePath("/torrents.php")
.AddQueryParam("id", groupId)
.AddQueryParam("torrentid", torrentId);
@@ -9,6 +9,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
{
public class PassThePopcornRequestGenerator : IIndexerRequestGenerator
{
public string BaseUrl { get; set; }
public PassThePopcornSettings Settings { get; set; }
public IDictionary<string, string> Cookies { get; set; }
@@ -39,7 +40,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
{
var request =
new IndexerRequest(
$"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}",
$"{BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}",
HttpAccept.Json);
request.HttpRequest.Headers["ApiUser"] = Settings.APIUser;
@@ -3,6 +3,7 @@ using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.PassThePopcorn
@@ -11,23 +12,19 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
{
public PassThePopcornSettingsValidator()
{
RuleFor(c => c.BaseUrl).ValidRootUrl();
RuleFor(c => c.APIUser).NotEmpty();
RuleFor(c => c.APIKey).NotEmpty();
}
}
public class PassThePopcornSettings : IIndexerSettings
public class PassThePopcornSettings : IProviderConfig
{
private static readonly PassThePopcornSettingsValidator Validator = new PassThePopcornSettingsValidator();
public PassThePopcornSettings()
{
BaseUrl = "https://passthepopcorn.me";
}
public string BaseUrl { get; set; }
[FieldDefinition(0, Label = "APIUser", HelpText = "These settings are found in your PassThePopcorn security settings (Edit Profile > Security).", Privacy = PrivacyLevel.UserName)]
public string APIUser { get; set; }