diff --git a/src/Jackett.Common/Indexers/BakaBT.cs b/src/Jackett.Common/Indexers/BakaBT.cs
index 2389b3688..3a87ce1ee 100644
--- a/src/Jackett.Common/Indexers/BakaBT.cs
+++ b/src/Jackett.Common/Indexers/BakaBT.cs
@@ -24,6 +24,8 @@ namespace Jackett.Common.Indexers
private string LoginUrl => SiteLink + "login.php";
private readonly string LogoutStr = "Logout";
+ private readonly List defaultCategories = new List {TorznabCatType.TVAnime.ID};
+
private new ConfigurationDataBasicLogin configData
{
get => (ConfigurationDataBasicLogin)base.configData;
@@ -46,6 +48,15 @@ namespace Jackett.Common.Indexers
Encoding = Encoding.UTF8;
Language = "en-us";
Type = "private";
+ AddCategoryMapping(1, TorznabCatType.TVAnime, "Anime Series");
+ AddCategoryMapping(2, TorznabCatType.TVAnime, "OVA");
+ AddCategoryMapping(3, TorznabCatType.AudioOther, "Soundtrack");
+ AddCategoryMapping(4, TorznabCatType.BooksComics, "Manga");
+ AddCategoryMapping(5, TorznabCatType.TVAnime, "Anime Movie");
+ AddCategoryMapping(6, TorznabCatType.TVOTHER, "Live Action");
+ AddCategoryMapping(7, TorznabCatType.BooksOther, "Artbook");
+ AddCategoryMapping(8, TorznabCatType.AudioVideo, "Music Video");
+ AddCategoryMapping(9, TorznabCatType.BooksEbook, "Light Novel");
}
public override async Task ApplyConfiguration(JToken configJson)
@@ -108,6 +119,7 @@ namespace Jackett.Common.Indexers
var parser = new HtmlParser();
var dom = parser.ParseDocument(response.Content);
var rows = dom.QuerySelectorAll(".torrents tr.torrent, .torrents tr.torrent_alt");
+ ICollection currentCategories = new List {TorznabCatType.TVAnime.ID};
foreach (var row in rows)
{
@@ -130,6 +142,8 @@ namespace Jackett.Common.Indexers
var titleSeries = title.Substring(0, titleSplit);
var releaseInfo = title.Substring(titleSplit);
+ currentCategories = GetNextCategory(row, currentCategories);
+
// For each over each pipe deliminated name
foreach (var name in titleSeries.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
{
@@ -153,7 +167,7 @@ namespace Jackett.Common.Indexers
release.Title = release.Title.Substring(0, insertPoint) + "Season 1 " + release.Title.Substring(insertPoint);
}
- release.Category = new List { TorznabCatType.TVAnime.ID };
+ release.Category = currentCategories;
release.Description = row.QuerySelector("span.tags")?.TextContent;
release.Guid = new Uri(SiteLink + qTitleLink.GetAttribute("href"));
release.Comments = release.Guid;
@@ -199,6 +213,37 @@ namespace Jackett.Common.Indexers
return releases;
}
+ private ICollection GetNextCategory(IElement row, ICollection currentCategories)
+ {
+ string nextCategoryName = GetCategoryName(row);
+ if (nextCategoryName != null)
+ {
+ currentCategories = MapTrackerCatDescToNewznab(nextCategoryName);
+ if (currentCategories.Count == 0)
+ return defaultCategories;
+ }
+
+ return currentCategories;
+ }
+
+ private string GetCategoryName(IElement row)
+ {
+ var categoryElement = row.QuerySelector("td.category span");
+ if (categoryElement == null)
+ {
+ return null;
+ }
+
+ var categoryName = categoryElement.GetAttribute("title");
+
+ if (!string.IsNullOrWhiteSpace(categoryName))
+ {
+ return categoryName;
+ }
+
+ return null;
+ }
+
public override async Task Download(Uri link)
{
var downloadPage = await RequestStringWithCookies(link.ToString());