Fixed: Only Sync Apps when Sync Enabled

pull/6/head
Qstick 4 years ago
parent 3f5306d647
commit a7dce5251f

@ -1,3 +1,4 @@
using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
@ -26,7 +27,7 @@ namespace NzbDrone.Core.Applications
{ {
var appDefinition = (ApplicationDefinition)message.Definition; var appDefinition = (ApplicationDefinition)message.Definition;
if (message.Definition.Enable) if (appDefinition.Enable)
{ {
var app = _applicationsFactory.GetInstance(appDefinition); var app = _applicationsFactory.GetInstance(appDefinition);
@ -36,9 +37,9 @@ namespace NzbDrone.Core.Applications
public void HandleAsync(ProviderAddedEvent<IIndexer> message) 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) foreach (var app in enabledApps)
{ {
app.AddIndexer((IndexerDefinition)message.Definition); app.AddIndexer((IndexerDefinition)message.Definition);
@ -47,9 +48,9 @@ namespace NzbDrone.Core.Applications
public void HandleAsync(ProviderDeletedEvent<IIndexer> message) 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) foreach (var app in enabledApps)
{ {
app.RemoveIndexer(message.ProviderId); app.RemoveIndexer(message.ProviderId);
@ -58,9 +59,9 @@ namespace NzbDrone.Core.Applications
public void HandleAsync(ProviderUpdatedEvent<IIndexer> message) 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) foreach (var app in enabledApps)
{ {
app.UpdateIndexer((IndexerDefinition)message.Definition); app.UpdateIndexer((IndexerDefinition)message.Definition);

Loading…
Cancel
Save