1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-27 22:57:09 -04:00

New: Add support for additional Torznab indexer flags

This commit is contained in:
Bogdan
2023-09-08 08:52:55 +03:00
parent a2bde5e016
commit ff3d38a515
12 changed files with 123 additions and 93 deletions
@@ -16,6 +16,7 @@ namespace NzbDrone.Core.Indexers.FileList
public uint Files { get; set; }
[JsonProperty(PropertyName = "imdb")]
public string ImdbId { get; set; }
public bool Internal { get; set; }
[JsonProperty(PropertyName = "freeleech")]
public bool FreeLeech { get; set; }
[JsonProperty(PropertyName = "upload_date")]
@@ -41,15 +41,20 @@ namespace NzbDrone.Core.Indexers.FileList
flags |= IndexerFlags.G_Freeleech;
}
if (result.Internal)
{
flags |= IndexerFlags.G_Internal;
}
var imdbId = 0;
if (result.ImdbId != null && result.ImdbId.Length > 2)
{
imdbId = int.Parse(result.ImdbId.Substring(2));
}
torrentInfos.Add(new TorrentInfo()
torrentInfos.Add(new TorrentInfo
{
Guid = string.Format("FileList-{0}", id),
Guid = $"FileList-{id}",
Title = result.Name,
Size = result.Size,
DownloadUrl = GetDownloadUrl(id),
@@ -62,7 +62,7 @@ namespace NzbDrone.Core.Indexers.HDBits
if (internalRelease)
{
flags |= IndexerFlags.HDB_Internal;
flags |= IndexerFlags.G_Internal;
}
torrentInfos.Add(new HDBitsInfo()
@@ -208,24 +208,45 @@ namespace NzbDrone.Core.Indexers.Torznab
IndexerFlags flags = 0;
var downloadFactor = TryGetFloatTorznabAttribute(item, "downloadvolumefactor", 1);
var uploadFactor = TryGetFloatTorznabAttribute(item, "uploadvolumefactor", 1);
if (uploadFactor == 2)
{
flags |= IndexerFlags.G_DoubleUpload;
}
if (downloadFactor == 0.5)
{
flags |= IndexerFlags.G_Halfleech;
}
if (downloadFactor == 0.75)
{
flags |= IndexerFlags.G_Freeleech25;
}
if (downloadFactor == 0.25)
{
flags |= IndexerFlags.G_Freeleech75;
}
if (downloadFactor == 0.0)
{
flags |= IndexerFlags.G_Freeleech;
}
if (uploadFactor == 2.0)
{
flags |= IndexerFlags.G_DoubleUpload;
}
var tags = TryGetMultipleTorznabAttributes(item, "tag");
if (tags.Any(t => t.EqualsIgnoreCase("internal")))
{
flags |= IndexerFlags.G_Internal;
}
if (tags.Any(t => t.EqualsIgnoreCase("scene")))
{
flags |= IndexerFlags.G_Scene;
}
return flags;
}