Nordicbits: category mapping and template 7 related fixes

This commit is contained in:
kaso17 2018-11-12 14:45:30 +01:00
parent 5eb4dbe550
commit 383d9ff4f8
1 changed files with 11 additions and 9 deletions

View File

@ -348,7 +348,7 @@ namespace Jackett.Common.Indexers
// Category // Category
string categoryID = tRow.Find("td:eq(0) > a:eq(0)").Attr("href").Split('?').Last(); string categoryID = tRow.Find("td:eq(0) > a:eq(0)").Attr("href").Split('?').Last();
var newznab = MapTrackerCatToNewznab(categoryID); var newznab = MapTrackerCatToNewznab(categoryID);
Output("Category: " + MapTrackerCatToNewznab(categoryID).First().ToString() + " (" + categoryID + ")"); Output("Category: " + (newznab.Count > 0 ? newznab.First().ToString() : "unknown category") + " (" + categoryID + ")");
// Seeders // Seeders
int seeders = ParseUtil.CoerceInt(Regex.Match(tRow.Find("td:eq(9)").Text(), @"\d+").Value); int seeders = ParseUtil.CoerceInt(Regex.Match(tRow.Find("td:eq(9)").Text(), @"\d+").Value);
@ -397,7 +397,7 @@ namespace Jackett.Common.Indexers
// Building release infos // Building release infos
var release = new ReleaseInfo var release = new ReleaseInfo
{ {
Category = MapTrackerCatToNewznab(categoryID.ToString()), Category = newznab,
Title = name, Title = name,
Seeders = seeders, Seeders = seeders,
Peers = seeders + leechers, Peers = seeders + leechers,
@ -680,7 +680,15 @@ namespace Jackett.Common.Indexers
{ {
var defaultTheme = new[] { "/templates/1/", "/templates/2/", "/templates/3/", "/templates/4/", "/templates/5/", "/templates/6/", "/templates/11/", "/templates/12/" }; var defaultTheme = new[] { "/templates/1/", "/templates/2/", "/templates/3/", "/templates/4/", "/templates/5/", "/templates/6/", "/templates/11/", "/templates/12/" };
var oldV2 = new[] { "/templates/7/", "/templates/8/", "/templates/9/", "/templates/10/", "/templates/14/" }; var oldV2 = new[] { "/templates/7/", "/templates/8/", "/templates/9/", "/templates/10/", "/templates/14/" };
// template 7 contains a reference to template 2 (logout button), so check for oldV2 first
if (oldV2.Any(_fDom.Document.Body.InnerHTML.Contains))
{
// Return all occurencis of torrents found
// $('#base_content > table.mainouter > tbody > tr > td.outer > div.article > table > tbody')
return _fDom["# base_content > table.mainouter > tbody > tr > td.outer > div.article > table > tbody > tr:not(:first)"];
}
if (defaultTheme.Any(_fDom.Document.Body.InnerHTML.Contains)) if (defaultTheme.Any(_fDom.Document.Body.InnerHTML.Contains))
{ {
// Return all occurencis of torrents found // Return all occurencis of torrents found
@ -688,12 +696,6 @@ namespace Jackett.Common.Indexers
return _fDom["# base_content2 > div.article > table > tbody:not(:first) > tr"]; return _fDom["# base_content2 > div.article > table > tbody:not(:first) > tr"];
} }
if (oldV2.Any(_fDom.Document.Body.InnerHTML.Contains))
{
// Return all occurencis of torrents found
// $('#base_content > table.mainouter > tbody > tr > td.outer > div.article > table > tbody')
return _fDom["# base_content > table.mainouter > tbody > tr > td.outer > div.article > table > tbody > tr:not(:first)"];
}
return _fDom; return _fDom;
} }