Cardigann: add support for default categories

This commit is contained in:
kaso17 2018-04-01 14:56:45 +02:00
parent ecec3d2006
commit 5b07e6424a
2 changed files with 10 additions and 0 deletions

View File

@ -31,6 +31,8 @@ namespace Jackett.Common.Indexers
protected WebClientStringResult landingResult;
protected IHtmlDocument landingResultDocument;
protected List<string> DefaultCategories = new List<string>();
new ConfigurationData configData
{
get { return (ConfigurationData)base.configData; }
@ -172,6 +174,8 @@ namespace Jackett.Common.Indexers
}
}
AddCategoryMapping(Categorymapping.id, TorznabCat, Categorymapping.desc);
if (Categorymapping.Default)
DefaultCategories.Add(Categorymapping.id);
}
}
LoadValuesFromJson(null);
@ -1082,6 +1086,11 @@ namespace Jackett.Common.Indexers
variables[".Query.Episode"] = query.GetEpisodeSearchString();
var mappedCategories = MapTorznabCapsToTrackers(query);
if (mappedCategories.Count == 0)
{
mappedCategories = this.DefaultCategories;
}
variables[".Categories"] = mappedCategories;
var KeywordTokens = new List<string>();

View File

@ -90,6 +90,7 @@ namespace Jackett.Common.Models
public string id { get; set; }
public string cat { get; set; }
public string desc { get; set; }
public bool Default { get; set; }
}
public class capabilitiesBlock