mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
@@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.IndexerTests.PTPTests
|
|||||||
var torrents = (await Subject.Fetch(new MovieSearchCriteria())).Releases;
|
var torrents = (await Subject.Fetch(new MovieSearchCriteria())).Releases;
|
||||||
|
|
||||||
torrents.Should().HaveCount(293);
|
torrents.Should().HaveCount(293);
|
||||||
torrents.First().Should().BeOfType<PassThePopcornInfo>();
|
torrents.First().Should().BeOfType<TorrentInfo>();
|
||||||
|
|
||||||
var first = torrents.First() as TorrentInfo;
|
var first = torrents.First() as TorrentInfo;
|
||||||
|
|
||||||
|
@@ -1,11 +0,0 @@
|
|||||||
using NzbDrone.Core.Parser.Model;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|
||||||
{
|
|
||||||
public class PassThePopcornInfo : TorrentInfo
|
|
||||||
{
|
|
||||||
public bool? Golden { get; set; }
|
|
||||||
public bool? Scene { get; set; }
|
|
||||||
public bool? Approved { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -94,7 +94,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
// Only add approved torrents
|
// Only add approved torrents
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
torrentInfos.Add(new PassThePopcornInfo()
|
torrentInfos.Add(new TorrentInfo()
|
||||||
{
|
{
|
||||||
Guid = string.Format("PassThePopcorn-{0}", id),
|
Guid = string.Format("PassThePopcorn-{0}", id),
|
||||||
Title = title,
|
Title = title,
|
||||||
@@ -104,9 +104,6 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
Seeders = int.Parse(torrent.Seeders),
|
Seeders = int.Parse(torrent.Seeders),
|
||||||
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
||||||
PublishDate = torrent.UploadTime.ToUniversalTime(),
|
PublishDate = torrent.UploadTime.ToUniversalTime(),
|
||||||
Golden = torrent.GoldenPopcorn,
|
|
||||||
Scene = torrent.Scene,
|
|
||||||
Approved = torrent.Checked,
|
|
||||||
ImdbId = result.ImdbId.IsNotNullOrWhiteSpace() ? int.Parse(result.ImdbId) : 0,
|
ImdbId = result.ImdbId.IsNotNullOrWhiteSpace() ? int.Parse(result.ImdbId) : 0,
|
||||||
IndexerFlags = flags,
|
IndexerFlags = flags,
|
||||||
MinimumRatio = 1,
|
MinimumRatio = 1,
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
|
using NzbDrone.Core.Parser;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||||
{
|
{
|
||||||
@@ -37,9 +39,21 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetRequest(string searchParameters)
|
private IEnumerable<IndexerRequest> GetRequest(string searchParameters)
|
||||||
{
|
{
|
||||||
|
var queryParams = new NameValueCollection
|
||||||
|
{
|
||||||
|
{ "action", "advanced" },
|
||||||
|
{ "json", "noredirect" },
|
||||||
|
{ "searchstr", searchParameters }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Settings.FreeleechOnly)
|
||||||
|
{
|
||||||
|
queryParams.Add("freetorrent", "1");
|
||||||
|
}
|
||||||
|
|
||||||
var request =
|
var request =
|
||||||
new IndexerRequest(
|
new IndexerRequest(
|
||||||
$"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}",
|
$"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?{queryParams.GetQueryString()}",
|
||||||
HttpAccept.Json);
|
HttpAccept.Json);
|
||||||
|
|
||||||
request.HttpRequest.Headers["ApiUser"] = Settings.APIUser;
|
request.HttpRequest.Headers["ApiUser"] = Settings.APIUser;
|
||||||
|
@@ -22,12 +22,15 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(2, Label = "APIUser", HelpText = "These settings are found in your PassThePopcorn security settings (Edit Profile > Security).", Privacy = PrivacyLevel.UserName)]
|
[FieldDefinition(2, Label = "API User", HelpText = "These settings are found in your PassThePopcorn security settings (Edit Profile > Security).", Privacy = PrivacyLevel.UserName)]
|
||||||
public string APIUser { get; set; }
|
public string APIUser { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(3, Label = "API Key", HelpText = "Site API Key", Privacy = PrivacyLevel.ApiKey)]
|
[FieldDefinition(3, Label = "API Key", HelpText = "Site API Key", Privacy = PrivacyLevel.ApiKey)]
|
||||||
public string APIKey { get; set; }
|
public string APIKey { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(4, Label = "Freeleech Only", HelpText = "Return only freeleech torrents", Type = FieldType.Checkbox)]
|
||||||
|
public bool FreeleechOnly { get; set; }
|
||||||
|
|
||||||
public override NzbDroneValidationResult Validate()
|
public override NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
Reference in New Issue
Block a user