2018-10-13 20:41:38 +00:00
|
|
|
using System.Linq;
|
2017-02-11 06:46:39 +00:00
|
|
|
using NzbDrone.Core.Messaging.Commands;
|
2015-01-16 00:30:09 +00:00
|
|
|
using NzbDrone.Core.Messaging.Events;
|
|
|
|
using NzbDrone.Core.Tv.Commands;
|
|
|
|
using NzbDrone.Core.Tv.Events;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Tv
|
|
|
|
{
|
2017-02-11 06:46:39 +00:00
|
|
|
public class SeriesAddedHandler : IHandle<SeriesAddedEvent>,
|
|
|
|
IHandle<SeriesImportedEvent>
|
2015-01-16 00:30:09 +00:00
|
|
|
{
|
|
|
|
private readonly IManageCommandQueue _commandQueueManager;
|
|
|
|
|
|
|
|
public SeriesAddedHandler(IManageCommandQueue commandQueueManager)
|
|
|
|
{
|
|
|
|
_commandQueueManager = commandQueueManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Handle(SeriesAddedEvent message)
|
|
|
|
{
|
2018-10-13 20:41:38 +00:00
|
|
|
_commandQueueManager.Push(new RefreshSeriesCommand(message.Series.Id, true));
|
2015-01-16 00:30:09 +00:00
|
|
|
}
|
2017-02-11 06:46:39 +00:00
|
|
|
|
|
|
|
public void Handle(SeriesImportedEvent message)
|
|
|
|
{
|
2018-10-13 20:41:38 +00:00
|
|
|
_commandQueueManager.PushMany(message.SeriesIds.Select(s => new RefreshSeriesCommand(s, true)).ToList());
|
2017-02-11 06:46:39 +00:00
|
|
|
}
|
2015-01-16 00:30:09 +00:00
|
|
|
}
|
|
|
|
}
|