From d35ad0ba493b66d15b9498b9760a8f30281b292a Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 12 May 2021 21:34:02 -0400 Subject: [PATCH] Fixed: Don't try re-add of a missing Indexer if capabilities don't support --- src/NzbDrone.Core/Applications/Lidarr/Lidarr.cs | 17 ++++++++++++----- src/NzbDrone.Core/Applications/Radarr/Radarr.cs | 17 ++++++++++++----- .../Applications/Readarr/Readarr.cs | 17 ++++++++++++----- src/NzbDrone.Core/Applications/Sonarr/Sonarr.cs | 17 ++++++++++++----- 4 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/NzbDrone.Core/Applications/Lidarr/Lidarr.cs b/src/NzbDrone.Core/Applications/Lidarr/Lidarr.cs index 31269af81..4df3e8ae5 100644 --- a/src/NzbDrone.Core/Applications/Lidarr/Lidarr.cs +++ b/src/NzbDrone.Core/Applications/Lidarr/Lidarr.cs @@ -107,12 +107,19 @@ namespace NzbDrone.Core.Applications.Lidarr } else { - _logger.Debug("Remote indexer not found, re-adding {0} to Lidarr", indexer.Name); - lidarrIndexer.Id = 0; - - var newRemoteIndexer = _lidarrV1Proxy.AddIndexer(lidarrIndexer, Settings); _appIndexerMapService.Delete(indexerMapping.Id); - _appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = newRemoteIndexer.Id }); + + if (indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray()).Any()) + { + _logger.Debug("Remote indexer not found, re-adding {0} to Lidarr", indexer.Name); + lidarrIndexer.Id = 0; + var newRemoteIndexer = _lidarrV1Proxy.AddIndexer(lidarrIndexer, Settings); + _appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = newRemoteIndexer.Id }); + } + else + { + _logger.Debug("Remote indexer not found for {0}, skipping re-add to Lidarr due to indexer capabilities", indexer.Name); + } } } diff --git a/src/NzbDrone.Core/Applications/Radarr/Radarr.cs b/src/NzbDrone.Core/Applications/Radarr/Radarr.cs index 2e4772325..ad0773091 100644 --- a/src/NzbDrone.Core/Applications/Radarr/Radarr.cs +++ b/src/NzbDrone.Core/Applications/Radarr/Radarr.cs @@ -107,12 +107,19 @@ namespace NzbDrone.Core.Applications.Radarr } else { - _logger.Debug("Remote indexer not found, re-adding {0} to Radarr", indexer.Name); - radarrIndexer.Id = 0; - - var newRemoteIndexer = _radarrV3Proxy.AddIndexer(radarrIndexer, Settings); _appIndexerMapService.Delete(indexerMapping.Id); - _appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = newRemoteIndexer.Id }); + + if (indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray()).Any()) + { + _logger.Debug("Remote indexer not found, re-adding {0} to Radarr", indexer.Name); + radarrIndexer.Id = 0; + var newRemoteIndexer = _radarrV3Proxy.AddIndexer(radarrIndexer, Settings); + _appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = newRemoteIndexer.Id }); + } + else + { + _logger.Debug("Remote indexer not found for {0}, skipping re-add to Radarr due to indexer capabilities", indexer.Name); + } } } diff --git a/src/NzbDrone.Core/Applications/Readarr/Readarr.cs b/src/NzbDrone.Core/Applications/Readarr/Readarr.cs index 026c0a075..e4b905878 100644 --- a/src/NzbDrone.Core/Applications/Readarr/Readarr.cs +++ b/src/NzbDrone.Core/Applications/Readarr/Readarr.cs @@ -107,12 +107,19 @@ namespace NzbDrone.Core.Applications.Readarr } else { - _logger.Debug("Remote indexer not found, re-adding {0} to Readarr", indexer.Name); - readarrIndexer.Id = 0; - - var newRemoteIndexer = _readarrV1Proxy.AddIndexer(readarrIndexer, Settings); _appIndexerMapService.Delete(indexerMapping.Id); - _appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = newRemoteIndexer.Id }); + + if (indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray()).Any()) + { + _logger.Debug("Remote indexer not found, re-adding {0} to Readarr", indexer.Name); + readarrIndexer.Id = 0; + var newRemoteIndexer = _readarrV1Proxy.AddIndexer(readarrIndexer, Settings); + _appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = newRemoteIndexer.Id }); + } + else + { + _logger.Debug("Remote indexer not found for {0}, skipping re-add to Readarr due to indexer capabilities", indexer.Name); + } } } diff --git a/src/NzbDrone.Core/Applications/Sonarr/Sonarr.cs b/src/NzbDrone.Core/Applications/Sonarr/Sonarr.cs index 6583610bb..6e0875db2 100644 --- a/src/NzbDrone.Core/Applications/Sonarr/Sonarr.cs +++ b/src/NzbDrone.Core/Applications/Sonarr/Sonarr.cs @@ -107,12 +107,19 @@ namespace NzbDrone.Core.Applications.Sonarr } else { - _logger.Debug("Remote indexer not found, re-adding {0} to Sonarr", indexer.Name); - sonarrIndexer.Id = 0; - - var newRemoteIndexer = _sonarrV3Proxy.AddIndexer(sonarrIndexer, Settings); _appIndexerMapService.Delete(indexerMapping.Id); - _appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = newRemoteIndexer.Id }); + + if (indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray()).Any()) + { + _logger.Debug("Remote indexer not found, re-adding {0} to Sonarr", indexer.Name); + sonarrIndexer.Id = 0; + var newRemoteIndexer = _sonarrV3Proxy.AddIndexer(sonarrIndexer, Settings); + _appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = newRemoteIndexer.Id }); + } + else + { + _logger.Debug("Remote indexer not found for {0}, skipping re-add to Sonarr due to indexer capabilities", indexer.Name); + } } }