New: Detect and map App Indexers setup outside of Prowlarr

This commit is contained in:
Qstick
2021-03-24 00:25:24 -04:00
parent 66237af562
commit 6e46cd09c1
11 changed files with 120 additions and 9 deletions

View File

@@ -111,6 +111,23 @@ namespace NzbDrone.Core.Applications
{
var indexerMappings = _appIndexerMapService.GetMappingsForApp(app.Definition.Id);
//Remote-Local mappings currently stored by Prowlarr
var prowlarrMappings = indexerMappings.ToDictionary(i => i.RemoteIndexerId, i => i.IndexerId);
//Get Dictionary of Remote Indexers point to Prowlarr and what they are mapped to
var remoteMappings = app.GetIndexerMappings();
//Add mappings if not already in db, these were setup manually in the app or orphaned by a table wipe
foreach (var mapping in remoteMappings)
{
if (!prowlarrMappings.ContainsKey(mapping.Key))
{
var addMapping = new AppIndexerMap { AppId = app.Definition.Id, RemoteIndexerId = mapping.Key, IndexerId = mapping.Value };
_appIndexerMapService.Insert(addMapping);
indexerMappings.Add(addMapping);
}
}
foreach (var indexer in indexers)
{
var definition = indexer;