New: Alternative Site Links

This commit is contained in:
Qstick
2021-06-13 23:09:42 -04:00
parent 1fb693d066
commit 38c09277d9
107 changed files with 587 additions and 558 deletions
@@ -10,7 +10,8 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
public class PassThePopcorn : TorrentIndexerBase<PassThePopcornSettings>
{
public override string Name => "PassThePopcorn";
public override string BaseUrl => "https://passthepopcorn.me";
public override string[] IndexerUrls => new string[] { "https://passthepopcorn.me" };
public override string Description => "";
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override bool SupportsRss => true;
@@ -36,8 +37,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
{
Settings = Settings,
HttpClient = _httpClient,
Logger = _logger,
BaseUrl = BaseUrl
Logger = _logger
};
}
@@ -80,7 +80,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
public override IParseIndexerResponse GetParser()
{
return new PassThePopcornParser(BaseUrl, Capabilities, _logger);
return new PassThePopcornParser(Settings, Capabilities, _logger);
}
}
@@ -12,12 +12,12 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
{
public class PassThePopcornParser : IParseIndexerResponse
{
private readonly string _baseUrl;
private readonly IndexerCapabilities _capabilities;
private readonly PassThePopcornSettings _settings;
private readonly Logger _logger;
public PassThePopcornParser(string baseUrl, IndexerCapabilities capabilities, Logger logger)
public PassThePopcornParser(PassThePopcornSettings settings, IndexerCapabilities capabilities, Logger logger)
{
_baseUrl = baseUrl;
_settings = settings;
_capabilities = capabilities;
_logger = logger;
}
@@ -133,7 +133,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
private string GetDownloadUrl(int torrentId, string authKey, string passKey)
{
var url = new HttpUri(_baseUrl)
var url = new HttpUri(_settings.BaseUrl)
.CombinePath("/torrents.php")
.AddQueryParam("action", "download")
.AddQueryParam("id", torrentId)
@@ -145,7 +145,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
private string GetInfoUrl(string groupId, int torrentId)
{
var url = new HttpUri(_baseUrl)
var url = new HttpUri(_settings.BaseUrl)
.CombinePath("/torrents.php")
.AddQueryParam("id", groupId)
.AddQueryParam("torrentid", torrentId);
@@ -9,7 +9,6 @@ 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; }
@@ -40,7 +39,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
{
var request =
new IndexerRequest(
$"{BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}",
$"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}",
HttpAccept.Json);
request.HttpRequest.Headers["ApiUser"] = Settings.APIUser;
@@ -1,6 +1,5 @@
using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.PassThePopcorn
@@ -14,7 +13,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
}
}
public class PassThePopcornSettings : IProviderConfig
public class PassThePopcornSettings : IIndexerSettings
{
private static readonly PassThePopcornSettingsValidator Validator = new PassThePopcornSettingsValidator();
@@ -22,10 +21,13 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
{
}
[FieldDefinition(0, Label = "APIUser", HelpText = "These settings are found in your PassThePopcorn security settings (Edit Profile > Security).", Privacy = PrivacyLevel.UserName)]
[FieldDefinition(1, Label = "Base Url", Type = FieldType.Select, SelectOptionsProviderAction = "getUrls", HelpText = "Select which baseurl Prowlarr will use for requests to the site")]
public string BaseUrl { get; set; }
[FieldDefinition(2, Label = "APIUser", HelpText = "These settings are found in your PassThePopcorn security settings (Edit Profile > Security).", Privacy = PrivacyLevel.UserName)]
public string APIUser { get; set; }
[FieldDefinition(1, Label = "APIKey", Type = FieldType.Password, Privacy = PrivacyLevel.Password)]
[FieldDefinition(3, Label = "APIKey", Type = FieldType.Password, Privacy = PrivacyLevel.Password)]
public string APIKey { get; set; }
public NzbDroneValidationResult Validate()