New: Sync Lists on Add and Update (#342)
parent
ad6e651090
commit
5a8e79eec2
@ -0,0 +1,26 @@
|
|||||||
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
using NzbDrone.Core.ThingiProvider.Events;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ImportLists
|
||||||
|
{
|
||||||
|
public class ImportListUpdatedHandler : IHandle<ProviderUpdatedEvent<IImportList>>, IHandle<ProviderAddedEvent<IImportList>>
|
||||||
|
{
|
||||||
|
private readonly IManageCommandQueue _commandQueueManager;
|
||||||
|
|
||||||
|
public ImportListUpdatedHandler(IManageCommandQueue commandQueueManager)
|
||||||
|
{
|
||||||
|
_commandQueueManager = commandQueueManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(ProviderUpdatedEvent<IImportList> message)
|
||||||
|
{
|
||||||
|
_commandQueueManager.Push(new ImportListSyncCommand(message.Definition.Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(ProviderAddedEvent<IImportList> message)
|
||||||
|
{
|
||||||
|
_commandQueueManager.Push(new ImportListSyncCommand(message.Definition.Id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ThingiProvider.Events
|
||||||
|
{
|
||||||
|
public class ProviderAddedEvent<TProvider> : IEvent
|
||||||
|
{
|
||||||
|
public ProviderDefinition Definition { get; private set; }
|
||||||
|
|
||||||
|
public ProviderAddedEvent(ProviderDefinition definition)
|
||||||
|
{
|
||||||
|
Definition = definition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue