public CardigannBase(IConfigService configService, CardigannDefinition definition, Logger logger) { _configService = configService; _definition = definition; _encoding = Encoding.GetEncoding(definition.Encoding); _logger = logger; SiteLink = definition.Links.First(); if (_definition.Caps.Categories != null) { foreach (var category in _definition.Caps.Categories) { var cat = NewznabStandardCategory.GetCatByName(category.Value); if (cat == null) { _logger.Error(string.Format("CardigannIndexer ({0}): invalid Torznab category for id {1}: {2}", _definition.Id, category.Key, category.Value)); continue; } AddCategoryMapping(category.Key, cat); } } if (_definition.Caps.Categorymappings != null) { foreach (var categorymapping in _definition.Caps.Categorymappings) { IndexerCategory torznabCat = null; if (categorymapping.cat != null) { torznabCat = NewznabStandardCategory.GetCatByName(categorymapping.cat); if (torznabCat == null) { _logger.Error(string.Format("CardigannIndexer ({0}): invalid Torznab category for id {1}: {2}", _definition.Id, categorymapping.id, categorymapping.cat)); continue; } } AddCategoryMapping(categorymapping.id, torznabCat, categorymapping.desc); if (categorymapping.Default) { _defaultCategories.Add(categorymapping.id); } } } }
private CardigannDefinition CleanIndexerDefinition(CardigannDefinition definition) { if (definition.Settings == null) { definition.Settings = new List <SettingsField> { new SettingsField { Name = "username", Label = "Username", Type = "text" }, new SettingsField { Name = "password", Label = "Password", Type = "password" } }; } if (definition.Encoding == null) { definition.Encoding = "UTF-8"; } if (definition.Login != null && definition.Login.Method == null) { definition.Login.Method = "form"; } if (definition.Search.Paths == null) { definition.Search.Paths = new List <SearchPathBlock>(); } // convert definitions with a single search Path to a Paths entry if (definition.Search.Path != null) { definition.Search.Paths.Add(new SearchPathBlock { Path = definition.Search.Path, Inheritinputs = true }); } return(definition); }
private void MapCardigannCategories(IndexerDefinition def, CardigannDefinition defFile) { if (defFile.Caps.Categories != null) { foreach (var category in defFile.Caps.Categories) { var cat = NewznabStandardCategory.GetCatByName(category.Value); if (cat == null) { continue; } def.Capabilities.Categories.AddCategoryMapping(category.Key, cat); } } if (defFile.Caps.Categorymappings != null) { foreach (var categorymapping in defFile.Caps.Categorymappings) { IndexerCategory torznabCat = null; if (categorymapping.cat != null) { torznabCat = NewznabStandardCategory.GetCatByName(categorymapping.cat); if (torznabCat == null) { continue; } } def.Capabilities.Categories.AddCategoryMapping(categorymapping.id, torznabCat, categorymapping.desc); //if (categorymapping.Default) //{ // DefaultCategories.Add(categorymapping.id); //} } } }
public CardigannConfigException(CardigannDefinition config, string message, params object[] args) : base(message, args) { _configuration = config; }
public CardigannConfigException(CardigannDefinition config, string message) : base(message) { _configuration = config; }
public CardigannRequestGenerator(IConfigService configService, CardigannDefinition definition, Logger logger) : base(configService, definition, logger) { }
public CardigannParser(IConfigService configService, CardigannDefinition definition, Logger logger) : base(configService, definition, logger) { }