mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: (Gazelle) Allow freeleech torrents with Use Freeleech Tokens
This commit is contained in:
@@ -59,8 +59,10 @@ public class GazelleParser : IParseIndexerResponse
|
||||
{
|
||||
foreach (var torrent in result.Torrents)
|
||||
{
|
||||
var isFreeLeech = torrent.IsFreeLeech || torrent.IsNeutralLeech || torrent.IsPersonalFreeLeech;
|
||||
|
||||
// skip releases that cannot be used with freeleech tokens when the option is enabled
|
||||
if (Settings.UseFreeleechToken && !torrent.CanUseToken)
|
||||
if (Settings.UseFreeleechToken && !torrent.CanUseToken && !isFreeLeech)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -79,7 +81,7 @@ public class GazelleParser : IParseIndexerResponse
|
||||
{
|
||||
Guid = infoUrl,
|
||||
InfoUrl = infoUrl,
|
||||
DownloadUrl = GetDownloadUrl(id, !torrent.IsFreeLeech && !torrent.IsNeutralLeech && !torrent.IsPersonalFreeLeech),
|
||||
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken && !isFreeLeech),
|
||||
Title = WebUtility.HtmlDecode(title),
|
||||
Container = torrent.Encoding,
|
||||
Files = torrent.FileCount,
|
||||
@@ -91,7 +93,7 @@ public class GazelleParser : IParseIndexerResponse
|
||||
PublishDate = torrent.Time.ToUniversalTime(),
|
||||
Scene = torrent.Scene,
|
||||
PosterUrl = posterUrl,
|
||||
DownloadVolumeFactor = torrent.IsFreeLeech || torrent.IsNeutralLeech || torrent.IsPersonalFreeLeech ? 0 : 1,
|
||||
DownloadVolumeFactor = isFreeLeech ? 0 : 1,
|
||||
UploadVolumeFactor = torrent.IsNeutralLeech ? 0 : 1
|
||||
};
|
||||
|
||||
@@ -110,8 +112,10 @@ public class GazelleParser : IParseIndexerResponse
|
||||
}
|
||||
else
|
||||
{
|
||||
var isFreeLeech = result.IsFreeLeech || result.IsNeutralLeech || result.IsPersonalFreeLeech;
|
||||
|
||||
// skip releases that cannot be used with freeleech tokens when the option is enabled
|
||||
if (Settings.UseFreeleechToken && !result.CanUseToken)
|
||||
if (Settings.UseFreeleechToken && !result.CanUseToken && !isFreeLeech)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -124,7 +128,7 @@ public class GazelleParser : IParseIndexerResponse
|
||||
{
|
||||
Guid = infoUrl,
|
||||
InfoUrl = infoUrl,
|
||||
DownloadUrl = GetDownloadUrl(id, !result.IsFreeLeech && !result.IsNeutralLeech && !result.IsPersonalFreeLeech),
|
||||
DownloadUrl = GetDownloadUrl(id, result.CanUseToken && !isFreeLeech),
|
||||
Title = groupName,
|
||||
Size = long.Parse(result.Size),
|
||||
Seeders = int.Parse(result.Seeders),
|
||||
@@ -133,7 +137,7 @@ public class GazelleParser : IParseIndexerResponse
|
||||
Grabs = result.Snatches,
|
||||
PublishDate = long.TryParse(result.GroupTime, out var num) ? DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime : DateTimeUtil.FromFuzzyTime((string)result.GroupTime),
|
||||
PosterUrl = posterUrl,
|
||||
DownloadVolumeFactor = result.IsFreeLeech || result.IsNeutralLeech || result.IsPersonalFreeLeech ? 0 : 1,
|
||||
DownloadVolumeFactor = isFreeLeech ? 0 : 1,
|
||||
UploadVolumeFactor = result.IsNeutralLeech ? 0 : 1
|
||||
};
|
||||
|
||||
|
@@ -168,8 +168,10 @@ public class GreatPosterWallParser : GazelleParser
|
||||
{
|
||||
foreach (var torrent in result.Torrents)
|
||||
{
|
||||
var isFreeLeech = torrent.IsFreeleech || torrent.IsNeutralLeech || torrent.IsPersonalFreeleech;
|
||||
|
||||
// skip releases that cannot be used with freeleech tokens when the option is enabled
|
||||
if (_settings.UseFreeleechToken && !torrent.CanUseToken)
|
||||
if (_settings.UseFreeleechToken && !torrent.CanUseToken && !isFreeLeech)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -181,7 +183,7 @@ public class GreatPosterWallParser : GazelleParser
|
||||
{
|
||||
Guid = infoUrl,
|
||||
InfoUrl = infoUrl,
|
||||
DownloadUrl = GetDownloadUrl(torrent.TorrentId, !torrent.IsFreeleech && !torrent.IsNeutralLeech && !torrent.IsPersonalFreeleech),
|
||||
DownloadUrl = GetDownloadUrl(torrent.TorrentId, torrent.CanUseToken && !isFreeLeech),
|
||||
Title = WebUtility.HtmlDecode(torrent.FileName).Trim(),
|
||||
PosterUrl = GetPosterUrl(result.Cover),
|
||||
PublishDate = new DateTimeOffset(time, TimeSpan.FromHours(8)).UtcDateTime, // Time is Chinese Time, add 8 hours difference from UTC
|
||||
@@ -192,7 +194,7 @@ public class GreatPosterWallParser : GazelleParser
|
||||
Grabs = torrent.Snatches,
|
||||
Files = torrent.FileCount,
|
||||
Scene = torrent.Scene,
|
||||
DownloadVolumeFactor = torrent.IsFreeleech || torrent.IsNeutralLeech || torrent.IsPersonalFreeleech ? 0 : 1,
|
||||
DownloadVolumeFactor = isFreeLeech ? 0 : 1,
|
||||
UploadVolumeFactor = torrent.IsNeutralLeech ? 0 : 1,
|
||||
MinimumRatio = 1,
|
||||
MinimumSeedTime = 172800 // 48 hours
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
|
@@ -263,12 +263,13 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
|
||||
var title = GetTitle(result, torrent);
|
||||
var infoUrl = GetInfoUrl(result.GroupId, id);
|
||||
var isFreeLeech = torrent.IsFreeLeech || torrent.IsNeutralLeech || torrent.IsFreeload || torrent.IsPersonalFreeLeech;
|
||||
|
||||
var release = new TorrentInfo
|
||||
{
|
||||
Guid = infoUrl,
|
||||
InfoUrl = infoUrl,
|
||||
DownloadUrl = GetDownloadUrl(id, !torrent.IsFreeLeech && !torrent.IsNeutralLeech && !torrent.IsFreeload && !torrent.IsPersonalFreeLeech),
|
||||
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken && !isFreeLeech),
|
||||
Title = WebUtility.HtmlDecode(title),
|
||||
Artist = WebUtility.HtmlDecode(result.Artist),
|
||||
Album = WebUtility.HtmlDecode(result.GroupName),
|
||||
@@ -282,7 +283,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
Scene = torrent.Scene,
|
||||
Files = torrent.FileCount,
|
||||
Grabs = torrent.Snatches,
|
||||
DownloadVolumeFactor = torrent.IsFreeLeech || torrent.IsNeutralLeech || torrent.IsFreeload || torrent.IsPersonalFreeLeech ? 0 : 1,
|
||||
DownloadVolumeFactor = isFreeLeech ? 0 : 1,
|
||||
UploadVolumeFactor = torrent.IsNeutralLeech || torrent.IsFreeload ? 0 : 1
|
||||
};
|
||||
|
||||
@@ -317,12 +318,13 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
|
||||
var id = result.TorrentId;
|
||||
var infoUrl = GetInfoUrl(result.GroupId, id);
|
||||
var isFreeLeech = result.IsFreeLeech || result.IsNeutralLeech || result.IsFreeload || result.IsPersonalFreeLeech;
|
||||
|
||||
var release = new TorrentInfo
|
||||
{
|
||||
Guid = infoUrl,
|
||||
InfoUrl = infoUrl,
|
||||
DownloadUrl = GetDownloadUrl(id, !result.IsFreeLeech && !result.IsNeutralLeech && !result.IsFreeload && !result.IsPersonalFreeLeech),
|
||||
DownloadUrl = GetDownloadUrl(id, result.CanUseToken && !isFreeLeech),
|
||||
Title = WebUtility.HtmlDecode(result.GroupName),
|
||||
Size = long.Parse(result.Size),
|
||||
Seeders = int.Parse(result.Seeders),
|
||||
@@ -330,7 +332,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
PublishDate = DateTimeOffset.FromUnixTimeSeconds(ParseUtil.CoerceLong(result.GroupTime)).UtcDateTime,
|
||||
Files = result.FileCount,
|
||||
Grabs = result.Snatches,
|
||||
DownloadVolumeFactor = result.IsFreeLeech || result.IsNeutralLeech || result.IsFreeload || result.IsPersonalFreeLeech ? 0 : 1,
|
||||
DownloadVolumeFactor = isFreeLeech ? 0 : 1,
|
||||
UploadVolumeFactor = result.IsNeutralLeech || result.IsFreeload ? 0 : 1
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user