brasiltracker: add quality to tv #13315

also add imdb and tmdb and poster and MST
This commit is contained in:
Garfield69
2022-06-26 08:37:42 +12:00
parent 63436ee0ea
commit 81c93f5d3a

View File

@@ -95,7 +95,7 @@ namespace Jackett.Common.Indexers
private static string StripSearchString(string term) private static string StripSearchString(string term)
{ {
// Search does not support searching with episode numbers so strip it if we have one // Search does not support searching with episode numbers so strip it if we have one
// AND filter the result later to archive the proper result // we will AND filter the result later to archive the proper result
term = _EpisodeRegex.Replace(term, string.Empty); term = _EpisodeRegex.Replace(term, string.Empty);
return term.TrimEnd(); return term.TrimEnd();
} }
@@ -148,6 +148,7 @@ namespace Jackett.Common.Indexers
var rows = searchResultDocument.QuerySelectorAll(rowsSelector); var rows = searchResultDocument.QuerySelectorAll(rowsSelector);
string groupTitle = null; string groupTitle = null;
string groupYearStr = null; string groupYearStr = null;
Uri groupPoster = null;
foreach (var row in rows) foreach (var row in rows)
try try
{ {
@@ -194,6 +195,9 @@ namespace Jackett.Common.Indexers
} }
yearStr ??= qDetailsLink.NextSibling.TextContent.Trim().TrimStart('[').TrimEnd(']'); yearStr ??= qDetailsLink.NextSibling.TextContent.Trim().TrimStart('[').TrimEnd(']');
if (Uri.TryCreate(row.QuerySelector("img[alt=\"Cover\"]")?.GetAttribute("src"),
UriKind.Absolute, out var posterUri))
groupPoster = posterUri;
if (row.ClassList.Contains("group")) // group headers if (row.ClassList.Contains("group")) // group headers
{ {
groupTitle = title; groupTitle = title;
@@ -205,7 +209,7 @@ namespace Jackett.Common.Indexers
var release = new ReleaseInfo var release = new ReleaseInfo
{ {
MinimumRatio = 1, MinimumRatio = 1,
MinimumSeedTime = 0 MinimumSeedTime = 172800
}; };
var qDlLink = row.QuerySelector("a[href^=\"torrents.php?action=download\"]"); var qDlLink = row.QuerySelector("a[href^=\"torrents.php?action=download\"]");
var qSize = row.QuerySelector("td:nth-last-child(4)"); var qSize = row.QuerySelector("td:nth-last-child(4)");
@@ -215,7 +219,7 @@ namespace Jackett.Common.Indexers
var qFreeLeech = row.QuerySelector("strong[title=\"Free\"]"); var qFreeLeech = row.QuerySelector("strong[title=\"Free\"]");
if (row.ClassList.Contains("group_torrent")) // torrents belonging to a group if (row.ClassList.Contains("group_torrent")) // torrents belonging to a group
{ {
release.Description = Regex.Match(qDetailsLink.TextContent, @"\[.*?\]").Value; release.Description = qDetailsLink.TextContent;
release.Title = ParseTitle(groupTitle, seasonEp, groupYearStr); release.Title = ParseTitle(groupTitle, seasonEp, groupYearStr);
} }
else if (row.ClassList.Contains("torrent")) // standalone/un grouped torrents else if (row.ClassList.Contains("torrent")) // standalone/un grouped torrents
@@ -223,6 +227,11 @@ namespace Jackett.Common.Indexers
release.Description = row.QuerySelector("div.torrent_info").TextContent; release.Description = row.QuerySelector("div.torrent_info").TextContent;
release.Title = ParseTitle(title, seasonEp, yearStr); release.Title = ParseTitle(title, seasonEp, yearStr);
} }
release.Poster = groupPoster;
var imdbLink = row.QuerySelector("a[href*=\"imdb.com/title/tt\"]")?.GetAttribute("href");
release.Imdb = ParseUtil.GetLongFromString(imdbLink);
var tmdbLink = row.QuerySelector("a[href*=\"themoviedb.org/\"]")?.GetAttribute("href");
release.TMDb = ParseUtil.GetLongFromString(tmdbLink);
release.Category = category; release.Category = category;
release.Description = release.Description.Replace(" / Free", ""); // Remove Free Tag release.Description = release.Description.Replace(" / Free", ""); // Remove Free Tag
release.Description = release.Description.Replace("/ WEB ", "/ WEB-DL "); // Fix web/web-dl release.Description = release.Description.Replace("/ WEB ", "/ WEB-DL "); // Fix web/web-dl
@@ -233,6 +242,7 @@ namespace Jackett.Common.Indexers
release.Description = release.Description.Replace("4K", "2160p"); release.Description = release.Description.Replace("4K", "2160p");
release.Description = release.Description.Replace("SD", "480p"); release.Description = release.Description.Replace("SD", "480p");
release.Description = release.Description.Replace("Dual Áudio", "Dual"); release.Description = release.Description.Replace("Dual Áudio", "Dual");
release.Description = release.Description.Replace("Dual Audio", "Dual");
// Adjust the description in order to can be read by Radarr and Sonarr // Adjust the description in order to can be read by Radarr and Sonarr
var cleanDescription = release.Description.Trim().TrimStart('[').TrimEnd(']'); var cleanDescription = release.Description.Trim().TrimStart('[').TrimEnd(']');