Minor cleanup for AnimeTorrents

This commit is contained in:
Bogdan
2025-02-12 15:50:29 +02:00
parent 4df8fc02f1
commit 44bdff8b8f

View File

@@ -292,7 +292,7 @@ namespace NzbDrone.Core.Indexers.Definitions
var qTitleLink = row.QuerySelector("td:nth-of-type(2) a:nth-of-type(1)"); var qTitleLink = row.QuerySelector("td:nth-of-type(2) a:nth-of-type(1)");
var title = qTitleLink?.TextContent.Trim(); var title = qTitleLink?.TextContent.Trim();
// If we search an get no results, we still get a table just with no info. // If we search and get no results, we still get a table just with no info.
if (title.IsNullOrWhiteSpace()) if (title.IsNullOrWhiteSpace())
{ {
break; break;
@@ -307,6 +307,8 @@ namespace NzbDrone.Core.Indexers.Definitions
var connections = row.QuerySelector("td:nth-of-type(8)").TextContent.Trim().Split('/', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); var connections = row.QuerySelector("td:nth-of-type(8)").TextContent.Trim().Split('/', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
var seeders = ParseUtil.CoerceInt(connections[0]); var seeders = ParseUtil.CoerceInt(connections[0]);
var leechers = ParseUtil.CoerceInt(connections[1]);
var grabs = ParseUtil.CoerceInt(connections[2]);
var categoryLink = row.QuerySelector("td:nth-of-type(1) a")?.GetAttribute("href") ?? string.Empty; var categoryLink = row.QuerySelector("td:nth-of-type(1) a")?.GetAttribute("href") ?? string.Empty;
var categoryId = ParseUtil.GetArgumentFromQueryString(categoryLink, "cat"); var categoryId = ParseUtil.GetArgumentFromQueryString(categoryLink, "cat");
@@ -328,17 +330,17 @@ namespace NzbDrone.Core.Indexers.Definitions
PublishDate = publishedDate, PublishDate = publishedDate,
Size = ParseUtil.GetBytes(row.QuerySelector("td:nth-of-type(6)").TextContent.Trim()), Size = ParseUtil.GetBytes(row.QuerySelector("td:nth-of-type(6)").TextContent.Trim()),
Seeders = seeders, Seeders = seeders,
Peers = ParseUtil.CoerceInt(connections[1]) + seeders, Peers = leechers + seeders,
Grabs = ParseUtil.CoerceInt(connections[2]), Grabs = grabs,
DownloadVolumeFactor = downloadVolumeFactor, DownloadVolumeFactor = downloadVolumeFactor,
UploadVolumeFactor = 1, UploadVolumeFactor = 1,
Genres = row.QuerySelectorAll("td:nth-of-type(2) a.tortags").Select(t => t.TextContent.Trim()).ToList() Genres = row.QuerySelectorAll("td:nth-of-type(2) a.tortags").Select(t => t.TextContent.Trim()).ToList()
}; };
var uLFactorImg = row.QuerySelector("img[alt*=\"x Multiplier Torrent\"]"); var uploadFactor = row.QuerySelector("img[alt*=\"x Multiplier Torrent\"]")?.GetAttribute("alt");
if (uLFactorImg != null) if (uploadFactor != null)
{ {
release.UploadVolumeFactor = ParseUtil.CoerceDouble(uLFactorImg.GetAttribute("alt").Split('x')[0]); release.UploadVolumeFactor = ParseUtil.CoerceDouble(uploadFactor.Split('x')[0]);
} }
releaseInfos.Add(release); releaseInfos.Add(release);
@@ -361,7 +363,7 @@ namespace NzbDrone.Core.Indexers.Definitions
[FieldDefinition(4, Label = "Freeleech Only", Type = FieldType.Checkbox, HelpText = "Show freeleech torrents only")] [FieldDefinition(4, Label = "Freeleech Only", Type = FieldType.Checkbox, HelpText = "Show freeleech torrents only")]
public bool FreeleechOnly { get; set; } public bool FreeleechOnly { get; set; }
[FieldDefinition(5, Label = "Downloadable Only", Type = FieldType.Checkbox, HelpText = "Search downloadable torrents only (enable this only if your account class is Newbie)")] [FieldDefinition(5, Label = "Downloadable Only", Type = FieldType.Checkbox, HelpText = "Search downloadable torrents only (enable this only if your account class is Newbie)", Advanced = true)]
public bool DownloadableOnly { get; set; } public bool DownloadableOnly { get; set; }
} }
} }