Remove Indexers from App when Removed in Prowlarr

pull/8/head
Qstick 4 years ago
parent 546bec3717
commit 79c96b86a4

@ -8,6 +8,7 @@ namespace NzbDrone.Core.Applications
{
List<AppIndexerMap> GetMappingsForApp(int appId);
AppIndexerMap Insert(AppIndexerMap appIndexerMap);
void Delete(int mappingId);
void DeleteAllForApp(int appId);
}
@ -25,6 +26,11 @@ namespace NzbDrone.Core.Applications
_appIndexerMapRepository.DeleteAllForApp(appId);
}
public void Delete(int mappingId)
{
_appIndexerMapRepository.Delete(mappingId);
}
public List<AppIndexerMap> GetMappingsForApp(int appId)
{
return _appIndexerMapRepository.GetMappingsForApp(appId);

@ -47,8 +47,16 @@ namespace NzbDrone.Core.Applications.Lidarr
public override void RemoveIndexer(int indexerId)
{
//Use the Id mapping here to delete the correct indexer
throw new System.NotImplementedException();
var appMappings = _appIndexerMapService.GetMappingsForApp(Definition.Id);
var indexerMapping = appMappings.FirstOrDefault(m => m.IndexerId == indexerId);
if (indexerMapping != null)
{
//Remove Indexer remotely and then remove the mapping
_lidarrV1Proxy.RemoveIndexer(indexerMapping.RemoteIndexerId, Settings);
_appIndexerMapService.Delete(indexerMapping.Id);
}
}
public override void UpdateIndexer(IndexerDefinition indexer)

@ -14,6 +14,7 @@ namespace NzbDrone.Core.Applications.Lidarr
LidarrIndexer AddIndexer(LidarrIndexer indexer, LidarrSettings settings);
List<LidarrIndexer> GetIndexers(LidarrSettings settings);
List<LidarrIndexer> GetIndexerSchema(LidarrSettings settings);
void RemoveIndexer(int indexerId, LidarrSettings settings);
ValidationFailure Test(LidarrSettings settings);
}

@ -47,8 +47,16 @@ namespace NzbDrone.Core.Applications.Radarr
public override void RemoveIndexer(int indexerId)
{
//Use the Id mapping here to delete the correct indexer
throw new System.NotImplementedException();
var appMappings = _appIndexerMapService.GetMappingsForApp(Definition.Id);
var indexerMapping = appMappings.FirstOrDefault(m => m.IndexerId == indexerId);
if (indexerMapping != null)
{
//Remove Indexer remotely and then remove the mapping
_radarrV3Proxy.RemoveIndexer(indexerMapping.RemoteIndexerId, Settings);
_appIndexerMapService.Delete(indexerMapping.Id);
}
}
public override void UpdateIndexer(IndexerDefinition indexer)

@ -14,6 +14,7 @@ namespace NzbDrone.Core.Applications.Radarr
RadarrIndexer AddIndexer(RadarrIndexer indexer, RadarrSettings settings);
List<RadarrIndexer> GetIndexers(RadarrSettings settings);
List<RadarrIndexer> GetIndexerSchema(RadarrSettings settings);
void RemoveIndexer(int indexerId, RadarrSettings settings);
ValidationFailure Test(RadarrSettings settings);
}

@ -47,8 +47,16 @@ namespace NzbDrone.Core.Applications.Readarr
public override void RemoveIndexer(int indexerId)
{
//Use the Id mapping here to delete the correct indexer
throw new System.NotImplementedException();
var appMappings = _appIndexerMapService.GetMappingsForApp(Definition.Id);
var indexerMapping = appMappings.FirstOrDefault(m => m.IndexerId == indexerId);
if (indexerMapping != null)
{
//Remove Indexer remotely and then remove the mapping
_readarrV1Proxy.RemoveIndexer(indexerMapping.RemoteIndexerId, Settings);
_appIndexerMapService.Delete(indexerMapping.Id);
}
}
public override void UpdateIndexer(IndexerDefinition indexer)

@ -14,6 +14,7 @@ namespace NzbDrone.Core.Applications.Readarr
ReadarrIndexer AddIndexer(ReadarrIndexer indexer, ReadarrSettings settings);
List<ReadarrIndexer> GetIndexers(ReadarrSettings settings);
List<ReadarrIndexer> GetIndexerSchema(ReadarrSettings settings);
void RemoveIndexer(int indexerId, ReadarrSettings settings);
ValidationFailure Test(ReadarrSettings settings);
}

@ -47,8 +47,16 @@ namespace NzbDrone.Core.Applications.Sonarr
public override void RemoveIndexer(int indexerId)
{
//Use the Id mapping here to delete the correct indexer
throw new System.NotImplementedException();
var appMappings = _appIndexerMapService.GetMappingsForApp(Definition.Id);
var indexerMapping = appMappings.FirstOrDefault(m => m.IndexerId == indexerId);
if (indexerMapping != null)
{
//Remove Indexer remotely and then remove the mapping
_sonarrV3Proxy.RemoveIndexer(indexerMapping.RemoteIndexerId, Settings);
_appIndexerMapService.Delete(indexerMapping.Id);
}
}
public override void UpdateIndexer(IndexerDefinition indexer)

@ -14,6 +14,7 @@ namespace NzbDrone.Core.Applications.Sonarr
SonarrIndexer AddIndexer(SonarrIndexer indexer, SonarrSettings settings);
List<SonarrIndexer> GetIndexers(SonarrSettings settings);
List<SonarrIndexer> GetIndexerSchema(SonarrSettings settings);
void RemoveIndexer(int indexerId, SonarrSettings settings);
ValidationFailure Test(SonarrSettings settings);
}

Loading…
Cancel
Save