From 3180e648b41cb8825ad53e4799d1e4adb7a5f4d0 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Fri, 13 Jan 2017 16:12:49 -0500 Subject: [PATCH 1/2] #236 #239 - Fixed user being needed, fixed age on torrentpotato --- .../Indexers/TorrentPotato/TorrentPotatoParser.cs | 1 + .../TorrentPotato/TorrentPotatoRequestGenerator.cs | 7 +++---- .../Indexers/TorrentPotato/TorrentPotatoResponse.cs | 1 + .../Indexers/TorrentPotato/TorrentPotatoSettings.cs | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs index 2c21e408e..fdaf7bb9d 100644 --- a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs +++ b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs @@ -40,6 +40,7 @@ namespace NzbDrone.Core.Indexers.TorrentPotato torrentInfo.Seeders = torrent.seeders; torrentInfo.Peers = torrent.leechers + torrent.seeders; torrentInfo.Freeleech = torrent.freeleech; + torrentInfo.PublishDate = torrent.publishdate.ToUniversalTime(); results.Add(torrentInfo); } diff --git a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoRequestGenerator.cs b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoRequestGenerator.cs index f85969d1e..5222d298b 100644 --- a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoRequestGenerator.cs @@ -78,9 +78,8 @@ namespace NzbDrone.Core.Indexers.TorrentPotato .Accept(HttpAccept.Json); requestBuilder.AddQueryParam("passkey", Settings.Passkey); - requestBuilder.AddQueryParam("user", Settings.User); - // requestBuilder.AddQueryParam("imdbid", "tt0076759"); //For now just search for Star Wars. - requestBuilder.AddQueryParam("search", "the"); // there has to be movies with 'the' in the title on any indexer + requestBuilder.AddQueryParam("user", !string.IsNullOrWhiteSpace(Settings.User) ? Settings.User : ""); + requestBuilder.AddQueryParam("search", "the"); yield return new IndexerRequest(requestBuilder.Build()); } @@ -91,7 +90,7 @@ namespace NzbDrone.Core.Indexers.TorrentPotato .Accept(HttpAccept.Json); requestBuilder.AddQueryParam("passkey", Settings.Passkey); - requestBuilder.AddQueryParam("user", Settings.User); + requestBuilder.AddQueryParam("user", !string.IsNullOrWhiteSpace(Settings.User) ? Settings.User : ""); if (searchCriteria.Movie.ImdbId.IsNotNullOrWhiteSpace()) { diff --git a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoResponse.cs b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoResponse.cs index 9b8300405..b0551ca67 100644 --- a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoResponse.cs +++ b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoResponse.cs @@ -21,6 +21,7 @@ namespace NzbDrone.Core.Indexers.TorrentPotato public int size { get; set; } public int leechers { get; set; } public int seeders { get; set; } + public DateTime publishdate { get; set; } } } diff --git a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoSettings.cs b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoSettings.cs index d0b902f5e..14c91e2d0 100644 --- a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoSettings.cs +++ b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoSettings.cs @@ -19,7 +19,7 @@ namespace NzbDrone.Core.Indexers.TorrentPotato public TorrentPotatoSettings() { - BaseUrl = ""; + BaseUrl = "http://127.0.0.1"; } [FieldDefinition(0, Label = "API URL", HelpText = "URL to TorrentPotato api.")] From d3bd0c9b692bf444ff796df2b733f466cea63b40 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Fri, 13 Jan 2017 16:16:31 -0500 Subject: [PATCH 2/2] This conditional makes more sense. --- .../TorrentPotato/TorrentPotatoRequestGenerator.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoRequestGenerator.cs b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoRequestGenerator.cs index 5222d298b..b9856250b 100644 --- a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoRequestGenerator.cs @@ -78,7 +78,10 @@ namespace NzbDrone.Core.Indexers.TorrentPotato .Accept(HttpAccept.Json); requestBuilder.AddQueryParam("passkey", Settings.Passkey); - requestBuilder.AddQueryParam("user", !string.IsNullOrWhiteSpace(Settings.User) ? Settings.User : ""); + if (!string.IsNullOrWhiteSpace(Settings.User)) + { + requestBuilder.AddQueryParam("user", Settings.User); + } requestBuilder.AddQueryParam("search", "the"); yield return new IndexerRequest(requestBuilder.Build()); @@ -90,7 +93,11 @@ namespace NzbDrone.Core.Indexers.TorrentPotato .Accept(HttpAccept.Json); requestBuilder.AddQueryParam("passkey", Settings.Passkey); - requestBuilder.AddQueryParam("user", !string.IsNullOrWhiteSpace(Settings.User) ? Settings.User : ""); + + if (!string.IsNullOrWhiteSpace(Settings.User)) + { + requestBuilder.AddQueryParam("user", Settings.User); + } if (searchCriteria.Movie.ImdbId.IsNotNullOrWhiteSpace()) {