Fixed: (Gazelle) Allow freeleech torrents with Use Freeleech Tokens

This commit is contained in:
Bogdan
2024-09-02 09:14:52 +03:00
parent 8301b669fe
commit 44c446943c
4 changed files with 27 additions and 17 deletions
@@ -289,12 +289,13 @@ namespace NzbDrone.Core.Indexers.Definitions
var title = GetTitle(result, torrent);
var infoUrl = GetInfoUrl(result.GroupId, id);
var isFreeLeech = torrent.IsFreeLeech || torrent.IsNeutralLeech || torrent.IsPersonalFreeLeech;
var release = new TorrentInfo
{
Guid = infoUrl,
InfoUrl = infoUrl,
DownloadUrl = GetDownloadUrl(id, !torrent.IsFreeLeech && !torrent.IsNeutralLeech && !torrent.IsPersonalFreeLeech),
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken && !isFreeLeech),
Title = WebUtility.HtmlDecode(title),
Artist = WebUtility.HtmlDecode(result.Artist),
Album = WebUtility.HtmlDecode(result.GroupName),
@@ -308,7 +309,7 @@ namespace NzbDrone.Core.Indexers.Definitions
Scene = torrent.Scene,
Files = torrent.FileCount,
Grabs = torrent.Snatches,
DownloadVolumeFactor = torrent.IsFreeLeech || torrent.IsNeutralLeech || torrent.IsPersonalFreeLeech ? 0 : 1,
DownloadVolumeFactor = isFreeLeech ? 0 : 1,
UploadVolumeFactor = torrent.IsNeutralLeech ? 0 : 1
};
@@ -337,12 +338,13 @@ namespace NzbDrone.Core.Indexers.Definitions
var id = result.TorrentId;
var infoUrl = GetInfoUrl(result.GroupId, id);
var isFreeLeech = result.IsFreeLeech || result.IsNeutralLeech || result.IsPersonalFreeLeech;
var release = new TorrentInfo
{
Guid = infoUrl,
InfoUrl = infoUrl,
DownloadUrl = GetDownloadUrl(id, !result.IsFreeLeech && !result.IsNeutralLeech && !result.IsPersonalFreeLeech),
DownloadUrl = GetDownloadUrl(id, result.CanUseToken && !isFreeLeech),
Title = WebUtility.HtmlDecode(result.GroupName),
Size = long.Parse(result.Size),
Seeders = int.Parse(result.Seeders),
@@ -350,7 +352,7 @@ namespace NzbDrone.Core.Indexers.Definitions
PublishDate = long.TryParse(result.GroupTime, out var num) ? DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime : DateTimeUtil.FromFuzzyTime(result.GroupTime),
Files = result.FileCount,
Grabs = result.Snatches,
DownloadVolumeFactor = result.IsFreeLeech || result.IsNeutralLeech || result.IsPersonalFreeLeech ? 0 : 1,
DownloadVolumeFactor = isFreeLeech ? 0 : 1,
UploadVolumeFactor = result.IsNeutralLeech ? 0 : 1
};