Make Cardigann indexers deletable

This commit is contained in:
kaso17 2016-12-10 18:20:04 +01:00
parent db4717b714
commit 2ffdc1678b
2 changed files with 10 additions and 1 deletions

View File

@ -24,6 +24,7 @@ namespace Jackett.Indexers
{
public class CardigannIndexer : BaseIndexer, IIndexer
{
public string DefinitionString { get; protected set; }
protected IndexerDefinition Definition;
public new string ID { get { return (Definition != null ? Definition.Site : GetIndexerID(GetType())); } }
@ -144,6 +145,7 @@ namespace Jackett.Indexers
protected void Init(string DefinitionString)
{
this.DefinitionString = DefinitionString;
var deserializer = new DeserializerBuilder()
.WithNamingConvention(new CamelCaseNamingConvention())
.IgnoreUnmatchedProperties()

View File

@ -140,7 +140,14 @@ namespace Jackett.Services
var indexer = GetIndexer(name);
var configPath = GetIndexerConfigFilePath(indexer);
File.Delete(configPath);
indexers[name] = container.ResolveNamed<IIndexer>(indexer.ID);
if (indexer.GetType() == typeof(CardigannIndexer))
{
indexers[name] = new CardigannIndexer(this, container.Resolve<IWebClient>(), logger, container.Resolve<IProtectionService>(), ((CardigannIndexer)indexer).DefinitionString);
}
else
{
indexers[name] = container.ResolveNamed<IIndexer>(indexer.ID);
}
}
private string GetIndexerConfigFilePath(IIndexer indexer)