|
|
|
@ -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<ReleaseInfo> 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
|
|
|
|
|