Skip to content

Commit

Permalink
brasiltracker: add quality to tv #13315
Browse files Browse the repository at this point in the history
also add imdb and tmdb and poster and MST
  • Loading branch information
garfield69 committed Jun 25, 2022
1 parent 63436ee commit 81c93f5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Jackett.Common/Indexers/BrasilTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static string InternationalTitle(string title)
private static string StripSearchString(string term)
{
// 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);
return term.TrimEnd();
}
Expand Down Expand Up @@ -148,6 +148,7 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer
var rows = searchResultDocument.QuerySelectorAll(rowsSelector);
string groupTitle = null;
string groupYearStr = null;
Uri groupPoster = null;
foreach (var row in rows)
try
{
Expand Down Expand Up @@ -194,6 +195,9 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer
}
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
{
groupTitle = title;
Expand All @@ -205,7 +209,7 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer
var release = new ReleaseInfo
{
MinimumRatio = 1,
MinimumSeedTime = 0
MinimumSeedTime = 172800
};
var qDlLink = row.QuerySelector("a[href^=\"torrents.php?action=download\"]");
var qSize = row.QuerySelector("td:nth-last-child(4)");
Expand All @@ -215,14 +219,19 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer
var qFreeLeech = row.QuerySelector("strong[title=\"Free\"]");
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);
}
else if (row.ClassList.Contains("torrent")) // standalone/un grouped torrents
{
release.Description = row.QuerySelector("div.torrent_info").TextContent;
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.Description = release.Description.Replace(" / Free", ""); // Remove Free Tag
release.Description = release.Description.Replace("/ WEB ", "/ WEB-DL "); // Fix web/web-dl
Expand All @@ -233,6 +242,7 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer
release.Description = release.Description.Replace("4K", "2160p");
release.Description = release.Description.Replace("SD", "480p");
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
var cleanDescription = release.Description.Trim().TrimStart('[').TrimEnd(']');
Expand Down

0 comments on commit 81c93f5

Please sign in to comment.