mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-03 05:25:10 +00:00
Fixed: (Gazelle) Ignore ineligible releases with Use Freeleech Token
This commit is contained in:
parent
72f1b2075b
commit
ca0b900d92
2 changed files with 26 additions and 16 deletions
|
@ -53,9 +53,14 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||
{
|
||||
foreach (var torrent in result.Torrents)
|
||||
{
|
||||
// skip releases that cannot be used with freeleech tokens when the option is enabled
|
||||
if (_settings.UseFreeleechToken && !torrent.CanUseToken)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var id = torrent.TorrentId;
|
||||
var artist = WebUtility.HtmlDecode(result.Artist);
|
||||
var album = WebUtility.HtmlDecode(result.GroupName);
|
||||
var infoUrl = GetInfoUrl(result.GroupId, id);
|
||||
|
||||
var title = $"{result.Artist} - {result.GroupName} ({result.GroupYear}) [{torrent.Format} {torrent.Encoding}] [{torrent.Media}]";
|
||||
if (torrent.HasCue)
|
||||
|
@ -65,17 +70,17 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||
|
||||
torrentInfos.Add(new GazelleInfo
|
||||
{
|
||||
Guid = string.Format("Gazelle-{0}", id),
|
||||
Artist = artist,
|
||||
Guid = infoUrl,
|
||||
InfoUrl = infoUrl,
|
||||
DownloadUrl = GetDownloadUrl(id, !torrent.IsFreeLeech && !torrent.IsNeutralLeech && !torrent.IsFreeload && !torrent.IsPersonalFreeLeech),
|
||||
|
||||
// Splice Title from info to avoid calling API again for every torrent.
|
||||
Title = WebUtility.HtmlDecode(title),
|
||||
Album = album,
|
||||
Artist = WebUtility.HtmlDecode(result.Artist),
|
||||
Album = WebUtility.HtmlDecode(result.GroupName),
|
||||
Container = torrent.Encoding,
|
||||
Codec = torrent.Format,
|
||||
Size = long.Parse(torrent.Size),
|
||||
DownloadUrl = GetDownloadUrl(id),
|
||||
InfoUrl = GetInfoUrl(result.GroupId, id),
|
||||
Seeders = int.Parse(torrent.Seeders),
|
||||
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
||||
PublishDate = torrent.Time.ToUniversalTime(),
|
||||
|
@ -109,7 +114,7 @@ private static IndexerFlags GetIndexerFlags(GazelleTorrent torrent)
|
|||
return flags;
|
||||
}
|
||||
|
||||
private string GetDownloadUrl(int torrentId)
|
||||
private string GetDownloadUrl(int torrentId, bool canUseToken)
|
||||
{
|
||||
var url = new HttpUri(_settings.BaseUrl)
|
||||
.CombinePath("/torrents.php")
|
||||
|
@ -119,7 +124,7 @@ private string GetDownloadUrl(int torrentId)
|
|||
.AddQueryParam("torrent_pass", _settings.PassKey);
|
||||
|
||||
// Orpheus fails to download if usetoken=0 so we need to only add if we will use one
|
||||
if (_settings.UseFreeleechToken)
|
||||
if (_settings.UseFreeleechToken && canUseToken)
|
||||
{
|
||||
url = url.AddQueryParam("usetoken", "1");
|
||||
}
|
||||
|
|
|
@ -46,19 +46,24 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||
{
|
||||
foreach (var torrent in result.Torrents)
|
||||
{
|
||||
// skip releases that cannot be used with freeleech tokens when the option is enabled
|
||||
if (_settings.UseFreeleechToken && !torrent.CanUseToken)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var id = torrent.TorrentId;
|
||||
var title = WebUtility.HtmlDecode(GetTitle(result, torrent));
|
||||
var artist = WebUtility.HtmlDecode(result.Artist);
|
||||
var album = WebUtility.HtmlDecode(result.GroupName);
|
||||
var infoUrl = GetInfoUrl(result.GroupId, id);
|
||||
|
||||
torrentInfos.Add(new GazelleInfo
|
||||
{
|
||||
Guid = $"Redacted-{id}",
|
||||
InfoUrl = GetInfoUrl(result.GroupId, id),
|
||||
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken),
|
||||
Guid = infoUrl,
|
||||
InfoUrl = infoUrl,
|
||||
DownloadUrl = GetDownloadUrl(id, !torrent.IsFreeLeech && !torrent.IsNeutralLeech && !torrent.IsFreeload && !torrent.IsPersonalFreeLeech),
|
||||
Title = title,
|
||||
Artist = artist,
|
||||
Album = album,
|
||||
Artist = WebUtility.HtmlDecode(result.Artist),
|
||||
Album = WebUtility.HtmlDecode(result.GroupName),
|
||||
Container = torrent.Encoding,
|
||||
Codec = torrent.Format,
|
||||
Size = long.Parse(torrent.Size),
|
||||
|
|
Loading…
Reference in a new issue