1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-01-01 04:38:20 +00:00

bjshare: Fix web format and series naming on 24h search (#8502)

This commit is contained in:
Christian Franchin 2020-05-03 19:21:54 -03:00 committed by GitHub
parent 6f5b9e098d
commit c72ad70b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,6 +164,36 @@ namespace Jackett.Common.Indexers
return false;
}
private string FixYearPosition(string title, string year)
{
int index = title.LastIndexOf('-');
// If its a series
if (index != -1)
{
title = title.Substring(0, index) + year + " " + title.Substring(index + 1);
}
else
{
title += " " + year;
}
return title;
}
private string FixNovelNumber(string title)
{
if (title.Contains("[Novela]"))
{
title = Regex.Replace(title, @"(Cap[\.]?[ ]?)", "S01E");
title = Regex.Replace(title, @"(\[Novela\]\ )", "");
title = Regex.Replace(title, @"(\ \-\s*Completo)", " - S01");
return title;
}
return title;
}
private string FixAbsoluteNumbering(string title)
{
// if result is absolute numbered, convert title from SXXEXX to EXX
@ -183,14 +213,6 @@ namespace Jackett.Common.Indexers
return title;
}
if (title.Contains("[Novela]"))
{
title = Regex.Replace(title, @"(Cap[\.]?[ ]?)", "S01E");
title = Regex.Replace(title, @"(\[Novela\]\ )", "");
title = Regex.Replace(title, @"(\ \-\s*Completo)", " - S01");
return title;
}
return title;
}
@ -296,6 +318,7 @@ namespace Jackett.Common.Indexers
}
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("Full HD", "1080p");
// Handles HDR conflict
release.Description = release.Description.Replace("/ HD /", "/ 720p /");
@ -398,6 +421,7 @@ namespace Jackett.Common.Indexers
var year = "";
release.Description = "";
var extraInfo = "";
var releaseQuality = "";
foreach (var child in qBJinfoBox.ChildNodes)
{
var type = child.NodeType;
@ -419,7 +443,16 @@ namespace Jackett.Common.Indexers
release.PublishDate = publishDate.ToLocalTime();
}
else if (line.StartsWith("Ano:"))
{
year = line.Substring("Ano: ".Length);
}
else if (line.StartsWith("Qualidade:"))
{
releaseQuality = line.Substring("Qualidade: ".Length);
if (releaseQuality == "WEB")
releaseQuality = "WEB-DL";
extraInfo += releaseQuality + " ";
}
else
{
release.Description += line + "\n";
@ -436,9 +469,12 @@ namespace Jackett.Common.Indexers
}
var catStr = qCatLink.GetAttribute("href").Split('=')[1].Split('&')[0];
release.Title = FixAbsoluteNumbering(release.Title);
if (!string.IsNullOrEmpty(year))
release.Title += " " + year;
release.Title = FixYearPosition(release.Title, year);
release.Title = FixAbsoluteNumbering(release.Title);
release.Title = FixNovelNumber(release.Title);
if (qQuality != null)
{
var quality = qQuality.TextContent;