Radarr/src/NzbDrone.Api/Indexers/IndexerModule.cs

43 lines
1.4 KiB
C#
Raw Normal View History

using NzbDrone.Core.Indexers;
namespace NzbDrone.Api.Indexers
{
public class IndexerModule : ProviderModuleBase<IndexerResource, IIndexer, IndexerDefinition>
{
2013-09-24 23:42:55 +00:00
public IndexerModule(IndexerFactory indexerFactory)
2013-10-01 17:27:22 +00:00
: base(indexerFactory, "indexer")
2013-06-27 07:37:39 +00:00
{
}
protected override void MapToResource(IndexerResource resource, IndexerDefinition definition)
{
base.MapToResource(resource, definition);
2019-12-22 21:24:11 +00:00
resource.EnableRss = definition.EnableRss;
resource.EnableSearch = definition.EnableAutomaticSearch || definition.EnableInteractiveSearch;
resource.SupportsRss = definition.SupportsRss;
resource.SupportsSearch = definition.SupportsSearch;
resource.Protocol = definition.Protocol;
}
protected override void MapToModel(IndexerDefinition definition, IndexerResource resource)
{
base.MapToModel(definition, resource);
definition.EnableRss = resource.EnableRss;
definition.EnableAutomaticSearch = resource.EnableSearch;
definition.EnableInteractiveSearch = resource.EnableSearch;
}
protected override void Validate(IndexerDefinition definition, bool includeWarnings)
{
2019-12-22 22:08:53 +00:00
if (!definition.Enable)
{
return;
}
base.Validate(definition, includeWarnings);
}
}
}