1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-01-01 12:46:23 +00:00

Fix to BJ-Share and Speed-Share (#2321)

* Fixed anime search on BJShare, removing the season from search and changing the output from "Anime SXXEXX" to "Anime EXX".
Season had to be removed because the season numbering on anime is all wrong in this tracker.

* - Changed to change title based on search for category of every row in bj-share, instead of category of search
- Fixed title parse on B2S-Share and Speed-Share to animes (series not changed) from "Anime SXXEXX" to "Anime EXX"

* - Added anime title change on empty search as well - BJ-Share

* B2S-Share: Removed episode from search and added andmatch (episode search do not work with translated series name), changed title to return 'original name SXXEXX' instead of 'translated name SXXEXX (original name)', because Sonarr was not recognizing the serie (it will only apply to series and movies, animes does not have translated name)

* added few comments to the code

* Fixed year being added after season/episode, it will be added now between series name and season/episode (animes not included), eg: Serie 2017 S05E06

* Small bugfixes in regex
This commit is contained in:
DarkSupremo 2017-12-26 02:02:43 -02:00 committed by garfield69
parent 2e8196b753
commit 68cbd6e6be
2 changed files with 33 additions and 10 deletions

View file

@ -220,6 +220,11 @@
,a[href^="torrents.php?cat=228"]
,a[href^="torrents.php?cat=191"]
attribute: href
year:
selector: td.label > div:contains("Lançamento:")
filters:
- name: replace
args: ["Lançamento:", ""]
title_anime:
selector: a[href^="torrents-details.php?id="]
filters:
@ -227,6 +232,9 @@
args: ["(Ep[\\.]?[ ]?)|([S]\\d\\d[Ee])", "E"]
title_normal:
selector: a[href^="torrents-details.php?id="]
filters:
- name: re_replace
args: ["^(.*?) - ((S(\\d{1,2}))?E(\\d{1,3}))", "$1 {{.Result.year}} $2"]
title:
text: "{{if .Result.is_anime }}{{ .Result.title_anime }}{{else}}{{ .Result.title_normal }}{{end}}"
filters:
@ -234,11 +242,16 @@
args: ["^(\\[XXX]\\s)", ""]
- name: replace
args: [" - NOVO!", ""]
title|append:
selector: td.label > div:contains("Lançamento:")
filters:
- name: replace
args: ["Lançamento:", ""]
- name: re_replace
args: ["(\\d{2})ª a (\\d{2})ª Temporada", "S$1-$2"]
- name: re_replace
args: ["(\\d{1})ª a (\\d{1})ª Temporada", "S0$1-0$2"]
- name: re_replace
args: ["(\\d{1})ª a (\\d{2})ª Temporada", "S0$1-$2"]
- name: re_replace
args: ["(\\d{2})ª Temporada", "S$1"]
- name: re_replace
args: ["(\\d{1})ª Temporada", "S0$1"]
title|append:
optional: true
selector: td.label > div:contains("Qualidade:")

View file

@ -238,20 +238,22 @@ Encoding = Encoding.UTF8;
ICollection<int> Category = null;
string YearStr = null;
Nullable<DateTime> YearPublishDate = null;
string CategoryStr = "";
if (Row.ClassList.Contains("group") || Row.ClassList.Contains("torrent")) // group/ungrouped headers
{
var qCatLink = Row.QuerySelector("a[href^=\"/torrents.php?filter_cat\"]");
string CategoryStr = qCatLink.GetAttribute("href").Split('=')[1].Split('&')[0];
CategoryStr = qCatLink.GetAttribute("href").Split('=')[1].Split('&')[0];
Category = MapTrackerCatToNewznab(CategoryStr);
YearStr = qDetailsLink.NextSibling.TextContent.Trim().TrimStart('[').TrimEnd(']');
YearPublishDate = DateTime.SpecifyKind(DateTime.ParseExact(YearStr, "yyyy", CultureInfo.InvariantCulture), DateTimeKind.Unspecified);
// if result is an anime, convert title from SXXEXX to EXX
if (CategoryStr == "14")
{
Title = Regex.Replace(Title, @"(Ep[\.]?[ ]?)|([S]\d\d[Ee])", "E");
}
YearStr = qDetailsLink.NextSibling.TextContent.Trim().TrimStart('[').TrimEnd(']');
YearPublishDate = DateTime.SpecifyKind(DateTime.ParseExact(YearStr, "yyyy", CultureInfo.InvariantCulture), DateTimeKind.Unspecified);
if (Row.ClassList.Contains("group")) // group headers
{
@ -278,7 +280,11 @@ Encoding = Encoding.UTF8;
if (Row.ClassList.Contains("group_torrent")) // torrents belonging to a group
{
release.Description = qDetailsLink.TextContent;
release.Title = GroupTitle + " " + GroupYearStr;
string cleanTitle = Regex.Replace(GroupTitle, @" - S?(?<season>\d{1,2})?E?(?<episode>\d{1,4})?", "");
string seasonEp = Regex.Replace(GroupTitle, @"^(.*?) - (S?(\d{1,2})?E?(\d{1,4})?)?", "$2");
release.Title = CategoryStr == "14" ? GroupTitle : cleanTitle + " " + GroupYearStr + " " + seasonEp;
release.PublishDate = GroupPublishDate.Value;
release.Category = GroupCategory;
}
@ -286,7 +292,11 @@ Encoding = Encoding.UTF8;
{
var qDescription = Row.QuerySelector("div.torrent_info");
release.Description = qDescription.TextContent;
release.Title = Title + " " + YearStr;
string cleanTitle = Regex.Replace(Title, @" - ((S(\d{1,2}))?E(\d{1,4}))", "");
string seasonEp = Regex.Replace(Title, @"^(.*?) - ((S(\d{1,2}))?E(\d{1,4}))", "$2");
release.Title = CategoryStr == "14" ? Title : cleanTitle + " " + YearStr + " " + seasonEp;
release.PublishDate = YearPublishDate.Value;
release.Category = Category;
}