mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Only Sync Apps when Sync Enabled
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
@@ -26,7 +27,7 @@ namespace NzbDrone.Core.Applications
|
||||
{
|
||||
var appDefinition = (ApplicationDefinition)message.Definition;
|
||||
|
||||
if (message.Definition.Enable)
|
||||
if (appDefinition.Enable)
|
||||
{
|
||||
var app = _applicationsFactory.GetInstance(appDefinition);
|
||||
|
||||
@@ -36,9 +37,9 @@ namespace NzbDrone.Core.Applications
|
||||
|
||||
public void HandleAsync(ProviderAddedEvent<IIndexer> message)
|
||||
{
|
||||
var enabledApps = _applicationsFactory.GetAvailableProviders();
|
||||
var enabledApps = _applicationsFactory.GetAvailableProviders()
|
||||
.Where(n => ((ApplicationDefinition)n.Definition).Enable);
|
||||
|
||||
// TODO: Only apps with Sync enabled
|
||||
foreach (var app in enabledApps)
|
||||
{
|
||||
app.AddIndexer((IndexerDefinition)message.Definition);
|
||||
@@ -47,9 +48,9 @@ namespace NzbDrone.Core.Applications
|
||||
|
||||
public void HandleAsync(ProviderDeletedEvent<IIndexer> message)
|
||||
{
|
||||
var enabledApps = _applicationsFactory.GetAvailableProviders();
|
||||
var enabledApps = _applicationsFactory.GetAvailableProviders()
|
||||
.Where(n => ((ApplicationDefinition)n.Definition).SyncLevel == ApplicationSyncLevel.FullSync);
|
||||
|
||||
// TODO: Only remove indexers when Sync is Full
|
||||
foreach (var app in enabledApps)
|
||||
{
|
||||
app.RemoveIndexer(message.ProviderId);
|
||||
@@ -58,9 +59,9 @@ namespace NzbDrone.Core.Applications
|
||||
|
||||
public void HandleAsync(ProviderUpdatedEvent<IIndexer> message)
|
||||
{
|
||||
var enabledApps = _applicationsFactory.GetAvailableProviders();
|
||||
var enabledApps = _applicationsFactory.GetAvailableProviders()
|
||||
.Where(n => ((ApplicationDefinition)n.Definition).SyncLevel == ApplicationSyncLevel.FullSync);
|
||||
|
||||
// TODO: Only upate indexers when Sync is Full
|
||||
foreach (var app in enabledApps)
|
||||
{
|
||||
app.UpdateIndexer((IndexerDefinition)message.Definition);
|
||||
|
Reference in New Issue
Block a user