From f577590ad6a40e048c2bdacf7bb8c03f102d041b Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Wed, 8 Feb 2017 14:26:11 -0500 Subject: [PATCH] Fix ordering in PTP, should prefer GP releases (#667) * Fix ordering in PTP, should prefer GP releases * Apply more checks --- .../PassThePopcorn/PassThePopcornParser.cs | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs index ef1ad3909..4e8c66051 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs @@ -56,14 +56,6 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn title = $"{title} ✔"; } - //if (IsPropertyExist(torrent, "RemasterTitle")) - //{ - // if (torrent.RemasterTitle != null) - // { - // title = $"{title} - {torrent.RemasterTitle}"; - // } - //} - // Only add approved torrents if (_settings.Approved && torrent.Checked) { @@ -109,9 +101,37 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn } // prefer golden + if (_settings.Golden) + { + if (_settings.Scene) + { + return + torrentInfos.OrderByDescending(o => o.PublishDate) + .ThenBy(o => ((dynamic)o).Golden ? 0 : 1) + .ThenBy(o => ((dynamic) o).Scene ? 0 : 1) + .ToArray(); + } + return + torrentInfos.OrderByDescending(o => o.PublishDate) + .ThenBy(o => ((dynamic)o).Golden ? 0 : 1) + .ToArray(); + } + // prefer scene - // require approval - return torrentInfos.OrderBy(o => ((dynamic)o).Golden ? 0 : 1).ThenBy(o => ((dynamic)o).Scene ? 0 : 1).ThenByDescending(o => ((dynamic)o).PublishDate).ToArray(); + if (_settings.Scene) + { + return + torrentInfos.OrderByDescending(o => o.PublishDate) + .ThenBy(o => ((dynamic)o).Scene ? 0 : 1) + .ToArray(); + } + + // order by date + return + torrentInfos + .OrderByDescending(o => o.PublishDate) + .ToArray(); + } private string GetDownloadUrl(int torrentId, string authKey, string passKey)