Added checkboxes for Gold and Checked torrents thanks @evulhotdog

This commit is contained in:
Devin Buhl 2017-01-08 15:09:14 -05:00
parent d1372f4d00
commit dbde41ab9d
2 changed files with 62 additions and 10 deletions

View file

@ -43,17 +43,65 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
foreach (var torrent in result.Torrents)
{
var id = torrent.Id;
torrentInfos.Add(new TorrentInfo()
if (_settings.GoldenOnly)
{
Guid = string.Format("PassThePopcorn-{0}", id),
Title = torrent.ReleaseName,
Size = Int64.Parse(torrent.Size),
DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey),
InfoUrl = GetInfoUrl(result.GroupId, id),
Seeders = Int32.Parse(torrent.Seeders),
Peers = Int32.Parse(torrent.Leechers) + Int32.Parse(torrent.Seeders),
PublishDate = torrent.UploadTime.ToUniversalTime()
});
if (torrent.GoldenPopcorn)
{
torrentInfos.Add(new TorrentInfo()
{
Guid = string.Format("PassThePopcorn-{0}", id),
Title = torrent.ReleaseName,
Size = Int64.Parse(torrent.Size),
DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey),
InfoUrl = GetInfoUrl(result.GroupId, id),
Seeders = Int32.Parse(torrent.Seeders),
Peers = Int32.Parse(torrent.Leechers) + Int32.Parse(torrent.Seeders),
PublishDate = torrent.UploadTime.ToUniversalTime()
});
}
else
{
continue;
}
}
if (_settings.CheckedOnly)
{
if (torrent.Checked)
{
torrentInfos.Add(new TorrentInfo()
{
Guid = string.Format("PassThePopcorn-{0}", id),
Title = torrent.ReleaseName,
Size = Int64.Parse(torrent.Size),
DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey),
InfoUrl = GetInfoUrl(result.GroupId, id),
Seeders = Int32.Parse(torrent.Seeders),
Peers = Int32.Parse(torrent.Leechers) + Int32.Parse(torrent.Seeders),
PublishDate = torrent.UploadTime.ToUniversalTime()
});
}
else
{
continue;
}
}
if (!_settings.GoldenOnly && !_settings.CheckedOnly)
{
torrentInfos.Add(new TorrentInfo()
{
Guid = string.Format("PassThePopcorn-{0}", id),
Title = torrent.ReleaseName,
Size = Int64.Parse(torrent.Size),
DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey),
InfoUrl = GetInfoUrl(result.GroupId, id),
Seeders = Int32.Parse(torrent.Seeders),
Peers = Int32.Parse(torrent.Leechers) + Int32.Parse(torrent.Seeders),
PublishDate = torrent.UploadTime.ToUniversalTime()
});
}
}
}

View file

@ -35,7 +35,11 @@ public PassThePopcornSettings()
[FieldDefinition(1, Label = "Cookie", HelpText = "PassThePopcorn uses a login cookie needed to access the API, you'll have to retrieve it via a browser.")]
public string Cookie { get; set; }
[FieldDefinition(2, Type = FieldType.Checkbox, Label = "Only Golden", HelpText = "Only include golden torrents.")]
public bool GoldenOnly { get; set; }
[FieldDefinition(3, Type = FieldType.Checkbox, Label = "Ony Staff Approved", HelpText = "Only include staff approved torrents.")]
public bool CheckedOnly { get; set; }
public NzbDroneValidationResult Validate()
{