mirror of
https://github.com/Jackett/Jackett
synced 2025-02-25 07:32:38 +00:00
Gracefully fail on Cardigann definitions Exceptions (#595)
This commit is contained in:
parent
595f006f22
commit
2b9b4282f4
1 changed files with 20 additions and 13 deletions
|
@ -74,22 +74,29 @@ namespace Jackett.Services
|
|||
{
|
||||
logger.Info("Loading Cardigann definitions from: " + path);
|
||||
|
||||
DirectoryInfo d = new DirectoryInfo(path);
|
||||
|
||||
foreach (var file in d.GetFiles("*.yml"))
|
||||
try
|
||||
{
|
||||
string DefinitionString = File.ReadAllText(file.FullName);
|
||||
CardigannIndexer idx = new CardigannIndexer(this, container.Resolve<IWebClient>(), logger, container.Resolve<IProtectionService>(), DefinitionString);
|
||||
if (indexers.ContainsKey(idx.ID))
|
||||
DirectoryInfo d = new DirectoryInfo(path);
|
||||
|
||||
foreach (var file in d.GetFiles("*.yml"))
|
||||
{
|
||||
logger.Debug(string.Format("Ignoring definition ID={0}, file={1}: Indexer already exists", idx.ID, file.FullName));
|
||||
}
|
||||
else
|
||||
{
|
||||
indexers.Add(idx.ID, idx);
|
||||
LoadIndexerConfig(idx);
|
||||
string DefinitionString = File.ReadAllText(file.FullName);
|
||||
CardigannIndexer idx = new CardigannIndexer(this, container.Resolve<IWebClient>(), logger, container.Resolve<IProtectionService>(), DefinitionString);
|
||||
if (indexers.ContainsKey(idx.ID))
|
||||
{
|
||||
logger.Debug(string.Format("Ignoring definition ID={0}, file={1}: Indexer already exists", idx.ID, file.FullName));
|
||||
}
|
||||
else
|
||||
{
|
||||
indexers.Add(idx.ID, idx);
|
||||
LoadIndexerConfig(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, "Error while loading Cardigann definitions: "+ ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public IIndexer GetIndexer(string name)
|
||||
|
|
Loading…
Reference in a new issue