diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs index b76470c35a..fd3c43dcb1 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs @@ -6,6 +6,7 @@ using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Parser.Model; using System; +using System.Linq; namespace NzbDrone.Core.Indexers.PassThePopcorn { @@ -57,7 +58,9 @@ public IList ParseResponse(IndexerResponse indexerResponse) InfoUrl = GetInfoUrl(result.GroupId, id), Seeders = Int32.Parse(torrent.Seeders), Peers = Int32.Parse(torrent.Leechers) + Int32.Parse(torrent.Seeders), - PublishDate = torrent.UploadTime.ToUniversalTime() + PublishDate = torrent.UploadTime.ToUniversalTime(), + Golden = torrent.GoldenPopcorn, + Checked = torrent.Checked }); } else @@ -79,7 +82,9 @@ public IList ParseResponse(IndexerResponse indexerResponse) InfoUrl = GetInfoUrl(result.GroupId, id), Seeders = Int32.Parse(torrent.Seeders), Peers = Int32.Parse(torrent.Leechers) + Int32.Parse(torrent.Seeders), - PublishDate = torrent.UploadTime.ToUniversalTime() + PublishDate = torrent.UploadTime.ToUniversalTime(), + Golden = torrent.GoldenPopcorn, + Checked = torrent.Checked }); } else @@ -99,13 +104,15 @@ public IList ParseResponse(IndexerResponse indexerResponse) InfoUrl = GetInfoUrl(result.GroupId, id), Seeders = Int32.Parse(torrent.Seeders), Peers = Int32.Parse(torrent.Leechers) + Int32.Parse(torrent.Seeders), - PublishDate = torrent.UploadTime.ToUniversalTime() + PublishDate = torrent.UploadTime.ToUniversalTime(), + Golden = torrent.GoldenPopcorn, + Checked = torrent.Checked }); } } } - return torrentInfos.ToArray(); + return torrentInfos.OrderBy(o => ((dynamic)o).Golden ? 0 : 1).ThenBy(o => ((dynamic)o).Checked ? 0 : 1).ThenBy(o => ((dynamic)o).PublishDate).ToArray(); } private string GetDownloadUrl(int torrentId, string authKey, string passKey) diff --git a/src/NzbDrone.Core/Parser/Model/TorrentInfo.cs b/src/NzbDrone.Core/Parser/Model/TorrentInfo.cs index dbbf7f1e9c..8f4f49982d 100644 --- a/src/NzbDrone.Core/Parser/Model/TorrentInfo.cs +++ b/src/NzbDrone.Core/Parser/Model/TorrentInfo.cs @@ -10,6 +10,10 @@ public class TorrentInfo : ReleaseInfo public int? Peers { get; set; } public bool Freeleech { get; set; } + // For PassThePopcorn + public bool? Golden { get; set; } + public bool? Checked { get; set; } + public static int? GetSeeders(ReleaseInfo release) { var torrentInfo = release as TorrentInfo;