mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: (Apps) Ensure populated capabilities for Torznab/Newznab definitions
This commit is contained in:
@@ -67,10 +67,11 @@ namespace NzbDrone.Core.Applications
|
|||||||
public void HandleAsync(ProviderAddedEvent<IIndexer> message)
|
public void HandleAsync(ProviderAddedEvent<IIndexer> message)
|
||||||
{
|
{
|
||||||
var enabledApps = _applicationsFactory.SyncEnabled();
|
var enabledApps = _applicationsFactory.SyncEnabled();
|
||||||
|
var indexer = _indexerFactory.GetInstance((IndexerDefinition)message.Definition);
|
||||||
|
|
||||||
foreach (var app in enabledApps)
|
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);
|
ExecuteAction(a => a.AddIndexer((IndexerDefinition)message.Definition), app);
|
||||||
}
|
}
|
||||||
@@ -92,8 +93,9 @@ namespace NzbDrone.Core.Applications
|
|||||||
var enabledApps = _applicationsFactory.SyncEnabled()
|
var enabledApps = _applicationsFactory.SyncEnabled()
|
||||||
.Where(n => ((ApplicationDefinition)n.Definition).SyncLevel == ApplicationSyncLevel.FullSync)
|
.Where(n => ((ApplicationDefinition)n.Definition).SyncLevel == ApplicationSyncLevel.FullSync)
|
||||||
.ToList();
|
.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)
|
public void HandleAsync(ApiKeyChangedEvent message)
|
||||||
|
@@ -43,14 +43,12 @@ namespace NzbDrone.Core.Indexers.Newznab
|
|||||||
|
|
||||||
public string[] GetBaseUrlFromSettings()
|
public string[] GetBaseUrlFromSettings()
|
||||||
{
|
{
|
||||||
var baseUrl = "";
|
if (Definition == null || Settings?.Categories == null)
|
||||||
|
|
||||||
if (Definition == null || Settings == 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)
|
protected override NewznabSettings GetDefaultBaseUrl(NewznabSettings settings)
|
||||||
@@ -62,7 +60,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
|||||||
{
|
{
|
||||||
var caps = new IndexerCapabilities();
|
var caps = new IndexerCapabilities();
|
||||||
|
|
||||||
if (Definition == null || Settings == null || Settings.Categories == null)
|
if (Definition == null || Settings?.Categories == null)
|
||||||
{
|
{
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
@@ -34,9 +34,8 @@ namespace NzbDrone.Core.Indexers.Newznab
|
|||||||
public IndexerCapabilities GetCapabilities(NewznabSettings indexerSettings, ProviderDefinition definition)
|
public IndexerCapabilities GetCapabilities(NewznabSettings indexerSettings, ProviderDefinition definition)
|
||||||
{
|
{
|
||||||
var key = indexerSettings.ToJson();
|
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)
|
private IndexerCapabilities FetchCapabilities(NewznabSettings indexerSettings, ProviderDefinition definition)
|
||||||
|
@@ -45,14 +45,12 @@ namespace NzbDrone.Core.Indexers.Torznab
|
|||||||
|
|
||||||
public string[] GetBaseUrlFromSettings()
|
public string[] GetBaseUrlFromSettings()
|
||||||
{
|
{
|
||||||
var baseUrl = "";
|
if (Definition == null || Settings?.Categories == null)
|
||||||
|
|
||||||
if (Definition == null || Settings == 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)
|
protected override TorznabSettings GetDefaultBaseUrl(TorznabSettings settings)
|
||||||
@@ -64,7 +62,7 @@ namespace NzbDrone.Core.Indexers.Torznab
|
|||||||
{
|
{
|
||||||
var caps = new IndexerCapabilities();
|
var caps = new IndexerCapabilities();
|
||||||
|
|
||||||
if (Definition == null || Settings == null || Settings.Categories == null)
|
if (Definition == null || Settings?.Categories == null)
|
||||||
{
|
{
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user