Fixed: Don't Add if Indexer doesn't support Apps categories

This commit is contained in:
Qstick
2021-03-01 22:20:06 -05:00
parent 696489731b
commit 39b9381f77
9 changed files with 66 additions and 29 deletions

View File

@@ -38,14 +38,17 @@ namespace NzbDrone.Core.Applications.Lidarr
public override void AddIndexer(IndexerDefinition indexer)
{
var schema = _schemaCache.Get(Definition.Settings.ToJson(), () => _lidarrV1Proxy.GetIndexerSchema(Settings), TimeSpan.FromDays(7));
var newznab = schema.Where(i => i.Implementation == "Newznab").First();
var torznab = schema.Where(i => i.Implementation == "Torznab").First();
if (indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray()).Any())
{
var schema = _schemaCache.Get(Definition.Settings.ToJson(), () => _lidarrV1Proxy.GetIndexerSchema(Settings), TimeSpan.FromDays(7));
var newznab = schema.Where(i => i.Implementation == "Newznab").First();
var torznab = schema.Where(i => i.Implementation == "Torznab").First();
var lidarrIndexer = BuildLidarrIndexer(indexer, indexer.Protocol == DownloadProtocol.Usenet ? newznab : torznab);
var lidarrIndexer = BuildLidarrIndexer(indexer, indexer.Protocol == DownloadProtocol.Usenet ? newznab : torznab);
var remoteIndexer = _lidarrV1Proxy.AddIndexer(lidarrIndexer, Settings);
_appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = remoteIndexer.Id });
var remoteIndexer = _lidarrV1Proxy.AddIndexer(lidarrIndexer, Settings);
_appIndexerMapService.Insert(new AppIndexerMap { AppId = Definition.Id, IndexerId = indexer.Id, RemoteIndexerId = remoteIndexer.Id });
}
}
public override void RemoveIndexer(int indexerId)