From 2782d19191013221f750ae535c31803ca372f3db Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Tue, 17 Apr 2018 01:21:14 +0200 Subject: [PATCH] Added: More logging for strange PTP errors. Please report them immediately when you see them. --- .../.idea.NzbDrone/.idea/contentModel.xml | 31 +++++++---- .../Indexers/PassThePopcorn/PassThePopcorn.cs | 2 +- .../PassThePopcorn/PassThePopcornParser.cs | 53 +++++++++++++------ 3 files changed, 58 insertions(+), 28 deletions(-) diff --git a/src/.idea/.idea.NzbDrone/.idea/contentModel.xml b/src/.idea/.idea.NzbDrone/.idea/contentModel.xml index 50671a366..9eec0f91a 100644 --- a/src/.idea/.idea.NzbDrone/.idea/contentModel.xml +++ b/src/.idea/.idea.NzbDrone/.idea/contentModel.xml @@ -1035,6 +1035,7 @@ + @@ -1330,6 +1331,8 @@ + + @@ -1656,6 +1659,7 @@ + @@ -1678,6 +1682,7 @@ + @@ -2597,6 +2602,7 @@ + @@ -2650,6 +2656,21 @@ + + + + + + + + + + + + + + + @@ -2895,16 +2916,6 @@ - - - - - - - - - - diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs index 2b9158678..21768d0ff 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs @@ -40,7 +40,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn public override IParseIndexerResponse GetParser() { - return new PassThePopcornParser(Settings); + return new PassThePopcornParser(Settings, _logger); } /*protected override IndexerResponse FetchIndexerResponse(IndexerRequest request) diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs index 5eada1d7b..493d50659 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs @@ -6,6 +6,7 @@ using NzbDrone.Common.Http; using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Parser.Model; using System.Linq; +using NLog; using NzbDrone.Common.Cache; using NzbDrone.Common.Extensions; @@ -14,9 +15,11 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn public class PassThePopcornParser : IParseIndexerResponse { private readonly PassThePopcornSettings _settings; - public PassThePopcornParser(PassThePopcornSettings settings) + private readonly Logger _logger; + public PassThePopcornParser(PassThePopcornSettings settings, Logger logger) { _settings = settings; + _logger = logger; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -79,23 +82,39 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn } // Only add approved torrents + try + { + torrentInfos.Add(new PassThePopcornInfo() + { + Guid = string.Format("PassThePopcorn-{0}", id), + Title = title, + Size = long.Parse(torrent.Size), + DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey), + InfoUrl = GetInfoUrl(result.GroupId, id), + 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 + }); + } + catch (Exception e) + { + _logger.Error(e, "Encountered exception parsing PTP torrent: {" + + $"Size: {torrent.Size}" + + $"UploadTime: {torrent.UploadTime}" + + $"Seeders: {torrent.Seeders}" + + $"Leechers: {torrent.Leechers}" + + $"ReleaseName: {torrent.ReleaseName}" + + $"ID: {torrent.Id}" + + "}. Please immediately report this info on https://github.com/Radarr/Radarr/issues/1584."); + throw; + } - torrentInfos.Add(new PassThePopcornInfo() - { - Guid = string.Format("PassThePopcorn-{0}", id), - Title = title, - Size = long.Parse(torrent.Size), - DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey), - InfoUrl = GetInfoUrl(result.GroupId, id), - 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 - }); + } } return