Sorted movie releases by golden -> checked -> upload date

This commit is contained in:
Devin Buhl 2017-01-08 16:37:22 -05:00
parent dbde41ab9d
commit 151d7f4d52
2 changed files with 15 additions and 4 deletions

View file

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

View file

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