Fixed: (Apps) Ensure populated capabilities for Torznab/Newznab definitions

pull/1803/head
Bogdan 10 months ago
parent cab50b35aa
commit 8b1dd78300

@ -67,10 +67,11 @@ namespace NzbDrone.Core.Applications
public void HandleAsync(ProviderAddedEvent<IIndexer> message)
{
var enabledApps = _applicationsFactory.SyncEnabled();
var indexer = _indexerFactory.GetInstance((IndexerDefinition)message.Definition);
foreach (var app in enabledApps)
{
if (ShouldHandleIndexer(app.Definition, message.Definition))
if (ShouldHandleIndexer(app.Definition, indexer.Definition))
{
ExecuteAction(a => a.AddIndexer((IndexerDefinition)message.Definition), app);
}
@ -92,8 +93,9 @@ namespace NzbDrone.Core.Applications
var enabledApps = _applicationsFactory.SyncEnabled()
.Where(n => ((ApplicationDefinition)n.Definition).SyncLevel == ApplicationSyncLevel.FullSync)
.ToList();
var indexer = _indexerFactory.GetInstance((IndexerDefinition)message.Definition);
SyncIndexers(enabledApps, new List<IndexerDefinition> { (IndexerDefinition)message.Definition });
SyncIndexers(enabledApps, new List<IndexerDefinition> { (IndexerDefinition)indexer.Definition });
}
public void HandleAsync(ApiKeyChangedEvent message)

@ -43,14 +43,12 @@ namespace NzbDrone.Core.Indexers.Newznab
public string[] GetBaseUrlFromSettings()
{
var baseUrl = "";
if (Definition == null || Settings == null || Settings.Categories == null)
if (Definition == null || Settings?.Categories == null)
{
return new string[] { baseUrl };
return new[] { "" };
}
return new string[] { Settings.BaseUrl };
return new[] { Settings.BaseUrl };
}
protected override NewznabSettings GetDefaultBaseUrl(NewznabSettings settings)
@ -62,7 +60,7 @@ namespace NzbDrone.Core.Indexers.Newznab
{
var caps = new IndexerCapabilities();
if (Definition == null || Settings == null || Settings.Categories == null)
if (Definition == null || Settings?.Categories == null)
{
return caps;
}

@ -34,9 +34,8 @@ namespace NzbDrone.Core.Indexers.Newznab
public IndexerCapabilities GetCapabilities(NewznabSettings indexerSettings, ProviderDefinition definition)
{
var key = indexerSettings.ToJson();
var capabilities = _capabilitiesCache.Get(key, () => FetchCapabilities(indexerSettings, definition), TimeSpan.FromDays(7));
return capabilities;
return _capabilitiesCache.Get(key, () => FetchCapabilities(indexerSettings, definition), TimeSpan.FromDays(7));
}
private IndexerCapabilities FetchCapabilities(NewznabSettings indexerSettings, ProviderDefinition definition)

@ -45,14 +45,12 @@ namespace NzbDrone.Core.Indexers.Torznab
public string[] GetBaseUrlFromSettings()
{
var baseUrl = "";
if (Definition == null || Settings == null || Settings.Categories == null)
if (Definition == null || Settings?.Categories == null)
{
return new string[] { baseUrl };
return new[] { "" };
}
return new string[] { Settings.BaseUrl };
return new[] { Settings.BaseUrl };
}
protected override TorznabSettings GetDefaultBaseUrl(TorznabSettings settings)
@ -64,7 +62,7 @@ namespace NzbDrone.Core.Indexers.Torznab
{
var caps = new IndexerCapabilities();
if (Definition == null || Settings == null || Settings.Categories == null)
if (Definition == null || Settings?.Categories == null)
{
return caps;
}

Loading…
Cancel
Save