From 1ccfde334f26ce600e4d4559c6ff97f5f55f8d52 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Tue, 14 Mar 2017 17:45:19 +0100 Subject: [PATCH] Maybe fix PTP? Don't have an account, so cannot test. We should realy add some ptp tests. --- .../PassThePopcorn/PassThePopcornParser.cs | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs index dfaf0ab92..3866400f0 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs @@ -51,20 +51,30 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn foreach (var result in jsonResponse.Movies) { - foreach (var torrent in result.Torrents) - { - var id = torrent.Id; - var title = torrent.ReleaseName; + foreach (var torrent in result.Torrents) + { + var id = torrent.Id; + var title = torrent.ReleaseName; - if (torrent.GoldenPopcorn) - { - title = $"{title} 🍿"; - } + if (torrent.GoldenPopcorn) + { + title = $"{title} 🍿"; + } + + if (torrent.Checked) + { + title = $"{title} ✔"; + } + + var imdbId = 0; + + int.TryParse(result.ImdbId, out imdbId); + + if (imdbId == 0 && result.ImdbId.Substring(0, 2) == "tt") + { + int.TryParse(result.ImdbId.Substring(2), out imdbId); + } - if (torrent.Checked) - { - title = $"{title} ✔"; - } // Only add approved torrents if (_settings.RequireApproved && torrent.Checked) @@ -82,7 +92,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn Golden = torrent.GoldenPopcorn, Scene = torrent.Scene, Approved = torrent.Checked, - ImdbId = int.Parse(result.ImdbId) + ImdbId = imdbId }); } // Add all torrents @@ -101,7 +111,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn Golden = torrent.GoldenPopcorn, Scene = torrent.Scene, Approved = torrent.Checked, - ImdbId = int.Parse(result.ImdbId) + ImdbId = imdbId }); } // Don't add any torrents