diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcorn.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcorn.cs index b1ef7273d..89ee85197 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcorn.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcorn.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.Threading.Tasks; using NLog; +using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Messaging.Events; @@ -39,6 +41,18 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn return new PassThePopcornParser(Settings, Capabilities.Categories); } + protected override Task GetDownloadRequest(Uri link) + { + var requestBuilder = new HttpRequestBuilder(link.AbsoluteUri); + + var request = requestBuilder + .SetHeader("ApiUser", Settings.APIUser) + .SetHeader("ApiKey", Settings.APIKey) + .Build(); + + return Task.FromResult(request); + } + private IndexerCapabilities SetCapabilities() { var caps = new IndexerCapabilities diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornApi.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornApi.cs index d6b2bb117..d126f0d1b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornApi.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornApi.cs @@ -5,10 +5,8 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn public class PassThePopcornResponse { public string TotalResults { get; set; } - public List Movies { get; set; } + public IReadOnlyCollection Movies { get; set; } public string Page { get; set; } - public string AuthKey { get; set; } - public string PassKey { get; set; } } public class PassThePopcornMovie @@ -18,9 +16,9 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn public string Title { get; set; } public string Year { get; set; } public string Cover { get; set; } - public List Tags { get; set; } + public IReadOnlyCollection Tags { get; set; } public string ImdbId { get; set; } - public List Torrents { get; set; } + public IReadOnlyCollection Torrents { get; set; } } public class PassThePopcornTorrent diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs index f12e2de86..fa5791a62 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using System.Net; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; @@ -95,7 +96,7 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn Title = title, Year = int.Parse(result.Year), InfoUrl = GetInfoUrl(result.GroupId, id), - DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey), + DownloadUrl = GetDownloadUrl(id), Categories = _categories.MapTrackerCatToNewznab(result.CategoryId), Size = long.Parse(torrent.Size), Grabs = int.Parse(torrent.Snatched), @@ -109,7 +110,7 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn UploadVolumeFactor = uploadVolumeFactor, MinimumRatio = 1, MinimumSeedTime = 345600, - Genres = result.Tags ?? new List(), + Genres = result.Tags?.ToList() ?? new List(), PosterUrl = GetPosterUrl(result.Cover) }); } @@ -120,14 +121,12 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn public Action, DateTime?> CookiesUpdater { get; set; } - private string GetDownloadUrl(int torrentId, string authKey, string passKey) + private string GetDownloadUrl(int torrentId) { var url = new HttpUri(_settings.BaseUrl) .CombinePath("/torrents.php") .AddQueryParam("action", "download") - .AddQueryParam("id", torrentId) - .AddQueryParam("authkey", authKey) - .AddQueryParam("torrent_pass", passKey); + .AddQueryParam("id", torrentId); return url.FullUri; }