Add poster URL to PassThePopcorn

pull/1889/head
Bogdan 1 year ago
parent eb642dd2f9
commit 6e7bf55dbd

@ -70,9 +70,6 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn
flags.Add(PassThePopcornFlag.Approved);
}
// Only add approved torrents
try
{
torrentInfos.Add(new TorrentInfo
{
Guid = $"PassThePopcorn-{id}",
@ -92,22 +89,10 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn
UploadVolumeFactor = 1,
MinimumRatio = 1,
MinimumSeedTime = 345600,
Genres = result.Tags ?? new List<string>()
Genres = result.Tags ?? new List<string>(),
PosterUrl = GetPosterUrl(result.Cover)
});
}
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/Prowlarr/Prowlarr/issues/1584.");
throw;
}
}
}
return torrentInfos;
@ -136,5 +121,17 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn
return url.FullUri;
}
private static string GetPosterUrl(string cover)
{
if (cover.IsNotNullOrWhiteSpace() &&
Uri.TryCreate(cover, UriKind.Absolute, out var posterUri) &&
(posterUri.Scheme == Uri.UriSchemeHttp || posterUri.Scheme == Uri.UriSchemeHttps))
{
return posterUri.AbsoluteUri;
}
return null;
}
}
}

Loading…
Cancel
Save