2017-01-21 21:13:55 +00:00
|
|
|
|
using NzbDrone.Api.ClientSchema;
|
|
|
|
|
using NzbDrone.Core.NetImport;
|
|
|
|
|
using NzbDrone.Core.Profiles;
|
2017-01-21 20:09:02 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.NetImport
|
|
|
|
|
{
|
|
|
|
|
public class NetImportModule : ProviderModuleBase<NetImportResource, INetImport, NetImportDefinition>
|
|
|
|
|
{
|
2017-01-21 21:13:55 +00:00
|
|
|
|
private readonly IProfileService _profileService;
|
|
|
|
|
public NetImportModule(NetImportFactory indexerFactory, IProfileService profileService)
|
2017-01-21 20:28:14 +00:00
|
|
|
|
: base(indexerFactory, "netimport")
|
2017-01-21 20:09:02 +00:00
|
|
|
|
{
|
2017-01-21 21:13:55 +00:00
|
|
|
|
_profileService = profileService;
|
2017-01-21 20:09:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void MapToResource(NetImportResource resource, NetImportDefinition definition)
|
|
|
|
|
{
|
|
|
|
|
base.MapToResource(resource, definition);
|
|
|
|
|
|
|
|
|
|
resource.Enabled = definition.Enabled;
|
2017-01-22 16:02:20 +00:00
|
|
|
|
resource.EnableAuto = definition.EnableAuto;
|
|
|
|
|
resource.ProfileId = definition.ProfileId;
|
2017-01-23 14:21:49 +00:00
|
|
|
|
resource.RootFolderPath = definition.RootFolderPath;
|
2017-01-21 20:09:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void MapToModel(NetImportDefinition definition, NetImportResource resource)
|
|
|
|
|
{
|
|
|
|
|
base.MapToModel(definition, resource);
|
|
|
|
|
|
2017-01-22 16:02:20 +00:00
|
|
|
|
definition.Enabled = resource.Enabled;
|
|
|
|
|
definition.EnableAuto = resource.EnableAuto;
|
|
|
|
|
definition.ProfileId = resource.ProfileId;
|
2017-01-23 14:21:49 +00:00
|
|
|
|
definition.RootFolderPath = resource.RootFolderPath;
|
2017-01-21 20:09:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Validate(NetImportDefinition definition, bool includeWarnings)
|
|
|
|
|
{
|
|
|
|
|
if (!definition.Enable) return;
|
|
|
|
|
base.Validate(definition, includeWarnings);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|