diff --git a/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs index 2f606c420..c27972e0f 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs @@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.IndexerTests.PTPTests var torrents = (await Subject.Fetch(new MovieSearchCriteria())).Releases; torrents.Should().HaveCount(293); - torrents.First().Should().BeOfType(); + torrents.First().Should().BeOfType(); var first = torrents.First() as TorrentInfo; diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornInfo.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornInfo.cs deleted file mode 100644 index b117d77c3..000000000 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornInfo.cs +++ /dev/null @@ -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; } - } -} diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs index 46273b077..d7ce9c862 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs @@ -94,7 +94,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn // Only add approved torrents try { - torrentInfos.Add(new PassThePopcornInfo() + torrentInfos.Add(new TorrentInfo() { Guid = string.Format("PassThePopcorn-{0}", id), Title = title, @@ -104,9 +104,6 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn Seeders = int.Parse(torrent.Seeders), Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders), PublishDate = torrent.UploadTime.ToUniversalTime(), - Golden = torrent.GoldenPopcorn, - Scene = torrent.Scene, - Approved = torrent.Checked, ImdbId = result.ImdbId.IsNotNullOrWhiteSpace() ? int.Parse(result.ImdbId) : 0, IndexerFlags = flags, MinimumRatio = 1, diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs index 40c1fd867..3bb7a3ff2 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using NLog; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.IndexerSearch.Definitions; +using NzbDrone.Core.Parser; namespace NzbDrone.Core.Indexers.PassThePopcorn { @@ -37,9 +39,21 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn private IEnumerable GetRequest(string searchParameters) { + var queryParams = new NameValueCollection + { + { "action", "advanced" }, + { "json", "noredirect" }, + { "searchstr", searchParameters } + }; + + if (Settings.FreeleechOnly) + { + queryParams.Add("freetorrent", "1"); + } + var request = new IndexerRequest( - $"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}", + $"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?{queryParams.GetQueryString()}", HttpAccept.Json); request.HttpRequest.Headers["ApiUser"] = Settings.APIUser; diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornSettings.cs index cf0ea42e5..8e7eabafc 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornSettings.cs @@ -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; } [FieldDefinition(3, Label = "API Key", HelpText = "Site API Key", Privacy = PrivacyLevel.ApiKey)] 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() { return new NzbDroneValidationResult(Validator.Validate(this));