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
string categoryID = tRow.Find("td:eq(0) > a:eq(0)").Attr("href").Split('?').Last();
var newznab = MapTrackerCatToNewznab(categoryID);
Output("Category: " + MapTrackerCatToNewznab(categoryID).First().ToString() + " (" + categoryID + ")");
Output("Category: " + (newznab.Count > 0 ? newznab.First().ToString() : "unknown category") + " (" + categoryID + ")");
// Seeders
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
var release = new ReleaseInfo
{
Category = MapTrackerCatToNewznab(categoryID.ToString()),
Category = newznab,
Title = name,
Seeders = seeders,
Peers = seeders + leechers,
@ -681,6 +681,14 @@ namespace Jackett.Common.Indexers
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/" };
// 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))
{
// 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"];
}
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;
}