mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 05:47:22 -04:00
Add poster URL to PassThePopcorn
This commit is contained in:
parent
eb642dd2f9
commit
6e7bf55dbd
1 changed files with 33 additions and 36 deletions
|
@ -70,43 +70,28 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn
|
|||
flags.Add(PassThePopcornFlag.Approved);
|
||||
}
|
||||
|
||||
// Only add approved torrents
|
||||
try
|
||||
torrentInfos.Add(new TorrentInfo
|
||||
{
|
||||
torrentInfos.Add(new TorrentInfo
|
||||
{
|
||||
Guid = $"PassThePopcorn-{id}",
|
||||
Title = torrent.ReleaseName,
|
||||
InfoUrl = GetInfoUrl(result.GroupId, id),
|
||||
DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey),
|
||||
Categories = new List<IndexerCategory> { NewznabStandardCategory.Movies },
|
||||
Size = long.Parse(torrent.Size),
|
||||
Grabs = int.Parse(torrent.Snatched),
|
||||
Seeders = int.Parse(torrent.Seeders),
|
||||
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
||||
PublishDate = DateTime.Parse(torrent.UploadTime + " +0000", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal),
|
||||
ImdbId = result.ImdbId.IsNotNullOrWhiteSpace() ? int.Parse(result.ImdbId) : 0,
|
||||
Scene = torrent.Scene,
|
||||
IndexerFlags = flags,
|
||||
DownloadVolumeFactor = torrent.FreeleechType is "Freeleech" ? 0 : 1,
|
||||
UploadVolumeFactor = 1,
|
||||
MinimumRatio = 1,
|
||||
MinimumSeedTime = 345600,
|
||||
Genres = result.Tags ?? new List<string>()
|
||||
});
|
||||
}
|
||||
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;
|
||||
}
|
||||
Guid = $"PassThePopcorn-{id}",
|
||||
Title = torrent.ReleaseName,
|
||||
InfoUrl = GetInfoUrl(result.GroupId, id),
|
||||
DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey),
|
||||
Categories = new List<IndexerCategory> { NewznabStandardCategory.Movies },
|
||||
Size = long.Parse(torrent.Size),
|
||||
Grabs = int.Parse(torrent.Snatched),
|
||||
Seeders = int.Parse(torrent.Seeders),
|
||||
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
||||
PublishDate = DateTime.Parse(torrent.UploadTime + " +0000", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal),
|
||||
ImdbId = result.ImdbId.IsNotNullOrWhiteSpace() ? int.Parse(result.ImdbId) : 0,
|
||||
Scene = torrent.Scene,
|
||||
IndexerFlags = flags,
|
||||
DownloadVolumeFactor = torrent.FreeleechType is "Freeleech" ? 0 : 1,
|
||||
UploadVolumeFactor = 1,
|
||||
MinimumRatio = 1,
|
||||
MinimumSeedTime = 345600,
|
||||
Genres = result.Tags ?? new List<string>(),
|
||||
PosterUrl = GetPosterUrl(result.Cover)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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…
Add table
Add a link
Reference in a new issue