mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
renamed EventAggregator to MessageAggregator
This commit is contained in:
parent
3638d85314
commit
7ae9e79540
@ -6,7 +6,7 @@
|
|||||||
using NzbDrone.Api.Extensions;
|
using NzbDrone.Api.Extensions;
|
||||||
using NzbDrone.Api.Frontend;
|
using NzbDrone.Api.Frontend;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
using TinyIoC;
|
using TinyIoC;
|
||||||
@ -30,7 +30,7 @@ protected override void ApplicationStartup(TinyIoCContainer container, IPipeline
|
|||||||
AutomapperBootstraper.InitializeAutomapper();
|
AutomapperBootstraper.InitializeAutomapper();
|
||||||
RegisterReporting(container);
|
RegisterReporting(container);
|
||||||
|
|
||||||
container.Resolve<IEventAggregator>().Publish(new ApplicationStartedEvent());
|
container.Resolve<IMessageAggregator>().Publish(new ApplicationStartedEvent());
|
||||||
|
|
||||||
ApplicationPipelines.OnError.AddItemToEndOfPipeline(container.Resolve<ErrorPipeline>().HandleException);
|
ApplicationPipelines.OnError.AddItemToEndOfPipeline(container.Resolve<ErrorPipeline>().HandleException);
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ protected override void ConfigureConventions(NancyConventions nancyConventions)
|
|||||||
|
|
||||||
public void Shutdown()
|
public void Shutdown()
|
||||||
{
|
{
|
||||||
ApplicationContainer.Resolve<IEventAggregator>().Publish(new ApplicationShutdownRequested());
|
ApplicationContainer.Resolve<IMessageAggregator>().Publish(new ApplicationShutdownRequested());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
using NzbDrone.Api.Extensions;
|
using NzbDrone.Api.Extensions;
|
||||||
using NzbDrone.Core.Providers;
|
|
||||||
using NzbDrone.Api.QualityType;
|
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Api.QualityProfiles
|
namespace NzbDrone.Api.QualityProfiles
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
using NzbDrone.Api.Extensions;
|
using NzbDrone.Api.Extensions;
|
||||||
using NzbDrone.Api.QualityProfiles;
|
|
||||||
using NzbDrone.Core.Providers;
|
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Api.QualityType
|
namespace NzbDrone.Api.QualityType
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
@ -14,7 +14,7 @@ public class ContainerFixture : TestBase
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_be_able_to_resolve_event_handlers()
|
public void should_be_able_to_resolve_event_handlers()
|
||||||
{
|
{
|
||||||
MainAppContainerBuilder.BuildContainer().Resolve<IEnumerable<IHandle>>().Should().NotBeEmpty();
|
MainAppContainerBuilder.BuildContainer().Resolve<IEnumerable<IProcessMessage>>().Should().NotBeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Common.Test.EventingTests
|
namespace NzbDrone.Common.Test.EventingTests
|
||||||
@ -17,7 +17,7 @@ public void should_publish_event_to_handlers()
|
|||||||
|
|
||||||
|
|
||||||
var intHandler = new Mock<IHandle<EventA>>();
|
var intHandler = new Mock<IHandle<EventA>>();
|
||||||
var aggregator = new EventAggregator(TestLogger, () => new List<IHandle> { intHandler.Object });
|
var aggregator = new MessageAggregator(TestLogger, () => new List<IProcessMessage> { intHandler.Object });
|
||||||
aggregator.Publish(eventA);
|
aggregator.Publish(eventA);
|
||||||
|
|
||||||
intHandler.Verify(c => c.Handle(eventA), Times.Once());
|
intHandler.Verify(c => c.Handle(eventA), Times.Once());
|
||||||
@ -30,7 +30,7 @@ public void should_publish_to_more_than_one_handler()
|
|||||||
|
|
||||||
var intHandler1 = new Mock<IHandle<EventA>>();
|
var intHandler1 = new Mock<IHandle<EventA>>();
|
||||||
var intHandler2 = new Mock<IHandle<EventA>>();
|
var intHandler2 = new Mock<IHandle<EventA>>();
|
||||||
var aggregator = new EventAggregator(TestLogger, () => new List<IHandle> { intHandler1.Object, intHandler2.Object });
|
var aggregator = new MessageAggregator(TestLogger, () => new List<IProcessMessage> { intHandler1.Object, intHandler2.Object });
|
||||||
aggregator.Publish(eventA);
|
aggregator.Publish(eventA);
|
||||||
|
|
||||||
intHandler1.Verify(c => c.Handle(eventA), Times.Once());
|
intHandler1.Verify(c => c.Handle(eventA), Times.Once());
|
||||||
@ -44,7 +44,7 @@ public void should_not_publish_to_incompatible_handlers()
|
|||||||
|
|
||||||
var aHandler = new Mock<IHandle<EventA>>();
|
var aHandler = new Mock<IHandle<EventA>>();
|
||||||
var bHandler = new Mock<IHandle<EventB>>();
|
var bHandler = new Mock<IHandle<EventB>>();
|
||||||
var aggregator = new EventAggregator(TestLogger, () => new List<IHandle> { aHandler.Object, bHandler.Object });
|
var aggregator = new MessageAggregator(TestLogger, () => new List<IProcessMessage> { aHandler.Object, bHandler.Object });
|
||||||
|
|
||||||
aggregator.Publish(eventA);
|
aggregator.Publish(eventA);
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace NzbDrone.Common.Eventing
|
|
||||||
{
|
|
||||||
public interface IEvent
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
6
NzbDrone.Common/Messaging/ICommand.cs
Normal file
6
NzbDrone.Common/Messaging/ICommand.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace NzbDrone.Common.Messaging
|
||||||
|
{
|
||||||
|
public interface ICommand : IMessage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
6
NzbDrone.Common/Messaging/IEvent.cs
Normal file
6
NzbDrone.Common/Messaging/IEvent.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace NzbDrone.Common.Messaging
|
||||||
|
{
|
||||||
|
public interface IEvent : IMessage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,10 @@
|
|||||||
using System.Linq;
|
namespace NzbDrone.Common.Messaging
|
||||||
|
|
||||||
namespace NzbDrone.Common.Eventing
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Denotes a class which can handle a particular type of message.
|
/// Denotes a class which can handle a particular type of message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name = "TEvent">The type of message to handle.</typeparam>
|
/// <typeparam name = "TEvent">The type of message to handle.</typeparam>
|
||||||
public interface IHandle<TEvent> : IHandle where TEvent : IEvent
|
public interface IHandle<TEvent> : IProcessMessage where TEvent : IEvent
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the message synchronously.
|
/// Handles the message synchronously.
|
||||||
@ -19,7 +17,7 @@ public interface IHandle<TEvent> : IHandle where TEvent : IEvent
|
|||||||
/// Denotes a class which can handle a particular type of message.
|
/// Denotes a class which can handle a particular type of message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name = "TEvent">The type of message to handle.</typeparam>
|
/// <typeparam name = "TEvent">The type of message to handle.</typeparam>
|
||||||
public interface IHandleAsync<TEvent> : IHandleAsync where TEvent : IEvent
|
public interface IHandleAsync<TEvent> : IProcessMessageAsync where TEvent : IEvent
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the message asynchronously.
|
/// Handles the message asynchronously.
|
||||||
@ -27,14 +25,4 @@ public interface IHandleAsync<TEvent> : IHandleAsync where TEvent : IEvent
|
|||||||
/// <param name = "message">The message.</param>
|
/// <param name = "message">The message.</param>
|
||||||
void HandleAsync(TEvent message);
|
void HandleAsync(TEvent message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A marker interface for classes that subscribe to messages.
|
|
||||||
/// </summary>
|
|
||||||
public interface IHandle { }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A marker interface for classes that subscribe to messages.
|
|
||||||
/// </summary>
|
|
||||||
public interface IHandleAsync : IHandle { }
|
|
||||||
}
|
}
|
6
NzbDrone.Common/Messaging/IMessage.cs
Normal file
6
NzbDrone.Common/Messaging/IMessage.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace NzbDrone.Common.Messaging
|
||||||
|
{
|
||||||
|
public interface IMessage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,11 @@
|
|||||||
using System;
|
namespace NzbDrone.Common.Messaging
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace NzbDrone.Common.Eventing
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables loosely-coupled publication of events.
|
/// Enables loosely-coupled publication of events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IEventAggregator
|
public interface IMessageAggregator
|
||||||
{
|
{
|
||||||
void Publish<TEvent>(TEvent message) where TEvent : IEvent;
|
void Publish<TEvent>(TEvent message) where TEvent : IEvent;
|
||||||
|
void Execute<TCommand>(TCommand message) where TCommand : ICommand;
|
||||||
}
|
}
|
||||||
}
|
}
|
12
NzbDrone.Common/Messaging/IProcessMessage.cs
Normal file
12
NzbDrone.Common/Messaging/IProcessMessage.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace NzbDrone.Common.Messaging
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A marker interface for classes that subscribe to messages.
|
||||||
|
/// </summary>
|
||||||
|
public interface IProcessMessage { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A marker interface for classes that subscribe to messages.
|
||||||
|
/// </summary>
|
||||||
|
public interface IProcessMessageAsync : IProcessMessage { }
|
||||||
|
}
|
@ -4,14 +4,14 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
namespace NzbDrone.Common.Eventing
|
namespace NzbDrone.Common.Messaging
|
||||||
{
|
{
|
||||||
public class EventAggregator : IEventAggregator
|
public class MessageAggregator : IMessageAggregator
|
||||||
{
|
{
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
private readonly Func<IEnumerable<IHandle>> _handlers;
|
private readonly Func<IEnumerable<IProcessMessage>> _handlers;
|
||||||
|
|
||||||
public EventAggregator(Logger logger, Func<IEnumerable<IHandle>> handlers)
|
public MessageAggregator(Logger logger, Func<IEnumerable<IProcessMessage>> handlers)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_handlers = handlers;
|
_handlers = handlers;
|
||||||
@ -40,5 +40,10 @@ public void Publish<TEvent>(TEvent message) where TEvent : IEvent
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Execute<TCommand>(TCommand message) where TCommand : ICommand
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -105,10 +105,13 @@
|
|||||||
<Compile Include="EnsureThat\Resources\ExceptionMessages.Designer.cs" />
|
<Compile Include="EnsureThat\Resources\ExceptionMessages.Designer.cs" />
|
||||||
<Compile Include="EnsureThat\StringExtensions.cs" />
|
<Compile Include="EnsureThat\StringExtensions.cs" />
|
||||||
<Compile Include="EnsureThat\TypeParam.cs" />
|
<Compile Include="EnsureThat\TypeParam.cs" />
|
||||||
<Compile Include="Eventing\EventAggregator.cs" />
|
<Compile Include="Messaging\ICommand.cs" />
|
||||||
<Compile Include="Eventing\IEvent.cs" />
|
<Compile Include="Messaging\IMessage.cs" />
|
||||||
<Compile Include="Eventing\IEventAggregator.cs" />
|
<Compile Include="Messaging\IProcessMessage.cs" />
|
||||||
<Compile Include="Eventing\IHandle.cs" />
|
<Compile Include="Messaging\MessageAggregator.cs" />
|
||||||
|
<Compile Include="Messaging\IEvent.cs" />
|
||||||
|
<Compile Include="Messaging\IMessageAggregator.cs" />
|
||||||
|
<Compile Include="Messaging\IHandle.cs" />
|
||||||
<Compile Include="Expansive\CircularReferenceException.cs" />
|
<Compile Include="Expansive\CircularReferenceException.cs" />
|
||||||
<Compile Include="Expansive\Expansive.cs" />
|
<Compile Include="Expansive\Expansive.cs" />
|
||||||
<Compile Include="Expansive\PatternStyle.cs" />
|
<Compile Include="Expansive\PatternStyle.cs" />
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
@ -21,16 +21,16 @@ public class DownloadService : IDownloadService
|
|||||||
{
|
{
|
||||||
private readonly IProvideDownloadClient _downloadClientProvider;
|
private readonly IProvideDownloadClient _downloadClientProvider;
|
||||||
private readonly IConfigService _configService;
|
private readonly IConfigService _configService;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IMessageAggregator _messageAggregator;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
|
|
||||||
public DownloadService(IProvideDownloadClient downloadClientProvider, IConfigService configService,
|
public DownloadService(IProvideDownloadClient downloadClientProvider, IConfigService configService,
|
||||||
IEventAggregator eventAggregator, Logger logger)
|
IMessageAggregator messageAggregator, Logger logger)
|
||||||
{
|
{
|
||||||
_downloadClientProvider = downloadClientProvider;
|
_downloadClientProvider = downloadClientProvider;
|
||||||
_configService = configService;
|
_configService = configService;
|
||||||
_eventAggregator = eventAggregator;
|
_messageAggregator = messageAggregator;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public bool DownloadReport(RemoteEpisode episode)
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
_logger.Info("Report sent to download client. {0}", downloadTitle);
|
_logger.Info("Report sent to download client. {0}", downloadTitle);
|
||||||
_eventAggregator.Publish(new EpisodeGrabbedEvent(episode));
|
_messageAggregator.Publish(new EpisodeGrabbedEvent(episode));
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Download
|
namespace NzbDrone.Core.Download
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.MediaFiles.Events;
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers
|
namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers
|
namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Newznab
|
namespace NzbDrone.Core.Indexers.Newznab
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
@ -14,16 +14,16 @@ public class RenameSeasonJob : IJob
|
|||||||
{
|
{
|
||||||
private readonly IMediaFileService _mediaFileService;
|
private readonly IMediaFileService _mediaFileService;
|
||||||
private readonly ISeriesRepository _seriesRepository;
|
private readonly ISeriesRepository _seriesRepository;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IMessageAggregator _messageAggregator;
|
||||||
private readonly IMoveEpisodeFiles _episodeFilesMover;
|
private readonly IMoveEpisodeFiles _episodeFilesMover;
|
||||||
|
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RenameSeasonJob(IMediaFileService mediaFileService, ISeriesRepository seriesRepository, IEventAggregator eventAggregator, IMoveEpisodeFiles episodeFilesMover)
|
public RenameSeasonJob(IMediaFileService mediaFileService, ISeriesRepository seriesRepository, IMessageAggregator messageAggregator, IMoveEpisodeFiles episodeFilesMover)
|
||||||
{
|
{
|
||||||
_mediaFileService = mediaFileService;
|
_mediaFileService = mediaFileService;
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
_eventAggregator = eventAggregator;
|
_messageAggregator = messageAggregator;
|
||||||
_episodeFilesMover = episodeFilesMover;
|
_episodeFilesMover = episodeFilesMover;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ public void Start(ProgressNotification notification, dynamic options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Start AfterRename
|
//Start AfterRename
|
||||||
_eventAggregator.Publish(new SeriesRenamedEvent(series));
|
_messageAggregator.Publish(new SeriesRenamedEvent(series));
|
||||||
|
|
||||||
notification.CurrentMessage = String.Format("Rename completed for {0} Season {1}", series.Title, options.SeasonNumber);
|
notification.CurrentMessage = String.Format("Rename completed for {0} Season {1}", series.Title, options.SeasonNumber);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
@ -14,16 +14,16 @@ public class RenameSeriesJob : IJob
|
|||||||
{
|
{
|
||||||
private readonly IMediaFileService _mediaFileService;
|
private readonly IMediaFileService _mediaFileService;
|
||||||
private readonly ISeriesRepository _seriesRepository;
|
private readonly ISeriesRepository _seriesRepository;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IMessageAggregator _messageAggregator;
|
||||||
private readonly IMoveEpisodeFiles _moveEpisodeFiles;
|
private readonly IMoveEpisodeFiles _moveEpisodeFiles;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RenameSeriesJob(IMediaFileService mediaFileService, ISeriesRepository seriesRepository, IEventAggregator eventAggregator, IMoveEpisodeFiles moveEpisodeFiles)
|
public RenameSeriesJob(IMediaFileService mediaFileService, ISeriesRepository seriesRepository, IMessageAggregator messageAggregator, IMoveEpisodeFiles moveEpisodeFiles)
|
||||||
{
|
{
|
||||||
_mediaFileService = mediaFileService;
|
_mediaFileService = mediaFileService;
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
_eventAggregator = eventAggregator;
|
_messageAggregator = messageAggregator;
|
||||||
_moveEpisodeFiles = moveEpisodeFiles;
|
_moveEpisodeFiles = moveEpisodeFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ public void Start(ProgressNotification notification, dynamic options)
|
|||||||
|
|
||||||
//Start AfterRename
|
//Start AfterRename
|
||||||
|
|
||||||
_eventAggregator.Publish(new SeriesRenamedEvent(series));
|
_messageAggregator.Publish(new SeriesRenamedEvent(series));
|
||||||
|
|
||||||
notification.CurrentMessage = String.Format("Rename completed for {0}", series.Title);
|
notification.CurrentMessage = String.Format("Rename completed for {0}", series.Title);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Jobs
|
namespace NzbDrone.Core.Jobs
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System.Timers;
|
using System.Timers;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Jobs
|
namespace NzbDrone.Core.Jobs
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Lifecycle
|
namespace NzbDrone.Core.Lifecycle
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Lifecycle
|
namespace NzbDrone.Core.Lifecycle
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Tv.Events;
|
using NzbDrone.Core.Tv.Events;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.MediaFiles.Events;
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
using NzbDrone.Core.Organizer;
|
using NzbDrone.Core.Organizer;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
@ -21,17 +21,17 @@ public class MoveEpisodeFiles : IMoveEpisodeFiles
|
|||||||
private readonly IEpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
private readonly IBuildFileNames _buildFileNames;
|
private readonly IBuildFileNames _buildFileNames;
|
||||||
private readonly IMediaFileService _mediaFileService;
|
private readonly IMediaFileService _mediaFileService;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IMessageAggregator _messageAggregator;
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public MoveEpisodeFiles(ISeriesRepository seriesRepository, IEpisodeService episodeService, IBuildFileNames buildFileNames, IMediaFileService mediaFileService, IEventAggregator eventAggregator, DiskProvider diskProvider, Logger logger)
|
public MoveEpisodeFiles(ISeriesRepository seriesRepository, IEpisodeService episodeService, IBuildFileNames buildFileNames, IMediaFileService mediaFileService, IMessageAggregator messageAggregator, DiskProvider diskProvider, Logger logger)
|
||||||
{
|
{
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
_buildFileNames = buildFileNames;
|
_buildFileNames = buildFileNames;
|
||||||
_mediaFileService = mediaFileService;
|
_mediaFileService = mediaFileService;
|
||||||
_eventAggregator = eventAggregator;
|
_messageAggregator = messageAggregator;
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public EpisodeFile MoveEpisodeFile(EpisodeFile episodeFile, bool newDownload = f
|
|||||||
|
|
||||||
if (newDownload)
|
if (newDownload)
|
||||||
{
|
{
|
||||||
_eventAggregator.Publish(new EpisodeDownloadedEvent(parsedEpisodeInfo, series));
|
_messageAggregator.Publish(new EpisodeDownloadedEvent(parsedEpisodeInfo, series));
|
||||||
}
|
}
|
||||||
|
|
||||||
return episodeFile;
|
return episodeFile;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.Events
|
namespace NzbDrone.Core.MediaFiles.Events
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.Events
|
namespace NzbDrone.Core.MediaFiles.Events
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.MediaFiles.Events;
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
@ -24,23 +24,23 @@ public class MediaFileService : IMediaFileService, IHandleAsync<SeriesDeletedEve
|
|||||||
{
|
{
|
||||||
private readonly IConfigService _configService;
|
private readonly IConfigService _configService;
|
||||||
private readonly IEpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IMessageAggregator _messageAggregator;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
private readonly IMediaFileRepository _mediaFileRepository;
|
private readonly IMediaFileRepository _mediaFileRepository;
|
||||||
|
|
||||||
public MediaFileService(IMediaFileRepository mediaFileRepository, IConfigService configService, IEpisodeService episodeService, IEventAggregator eventAggregator, Logger logger)
|
public MediaFileService(IMediaFileRepository mediaFileRepository, IConfigService configService, IEpisodeService episodeService, IMessageAggregator messageAggregator, Logger logger)
|
||||||
{
|
{
|
||||||
_mediaFileRepository = mediaFileRepository;
|
_mediaFileRepository = mediaFileRepository;
|
||||||
_configService = configService;
|
_configService = configService;
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
_eventAggregator = eventAggregator;
|
_messageAggregator = messageAggregator;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EpisodeFile Add(EpisodeFile episodeFile)
|
public EpisodeFile Add(EpisodeFile episodeFile)
|
||||||
{
|
{
|
||||||
var addedFile = _mediaFileRepository.Insert(episodeFile);
|
var addedFile = _mediaFileRepository.Insert(episodeFile);
|
||||||
_eventAggregator.Publish(new EpisodeFileAddedEvent(addedFile));
|
_messageAggregator.Publish(new EpisodeFileAddedEvent(addedFile));
|
||||||
return addedFile;
|
return addedFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ public void Update(EpisodeFile episodeFile)
|
|||||||
public void Delete(EpisodeFile episodeFile)
|
public void Delete(EpisodeFile episodeFile)
|
||||||
{
|
{
|
||||||
_mediaFileRepository.Delete(episodeFile);
|
_mediaFileRepository.Delete(episodeFile);
|
||||||
_eventAggregator.Publish(new EpisodeFileDeletedEvent(episodeFile));
|
_messageAggregator.Publish(new EpisodeFileDeletedEvent(episodeFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Exists(string path)
|
public bool Exists(string path)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Tv.Events;
|
using NzbDrone.Core.Tv.Events;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Qualities
|
namespace NzbDrone.Core.Qualities
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.MediaFiles.Events;
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
@ -45,19 +45,19 @@ public class EpisodeService : IEpisodeService,
|
|||||||
private readonly IProvideEpisodeInfo _episodeInfoProxy;
|
private readonly IProvideEpisodeInfo _episodeInfoProxy;
|
||||||
private readonly ISeasonRepository _seasonRepository;
|
private readonly ISeasonRepository _seasonRepository;
|
||||||
private readonly IEpisodeRepository _episodeRepository;
|
private readonly IEpisodeRepository _episodeRepository;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IMessageAggregator _messageAggregator;
|
||||||
private readonly IConfigService _configService;
|
private readonly IConfigService _configService;
|
||||||
private readonly ISeriesService _seriesService;
|
private readonly ISeriesService _seriesService;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public EpisodeService(IProvideEpisodeInfo episodeInfoProxy, ISeasonRepository seasonRepository,
|
public EpisodeService(IProvideEpisodeInfo episodeInfoProxy, ISeasonRepository seasonRepository,
|
||||||
IEpisodeRepository episodeRepository, IEventAggregator eventAggregator,
|
IEpisodeRepository episodeRepository, IMessageAggregator messageAggregator,
|
||||||
IConfigService configService, ISeriesService seriesService, Logger logger)
|
IConfigService configService, ISeriesService seriesService, Logger logger)
|
||||||
{
|
{
|
||||||
_episodeInfoProxy = episodeInfoProxy;
|
_episodeInfoProxy = episodeInfoProxy;
|
||||||
_seasonRepository = seasonRepository;
|
_seasonRepository = seasonRepository;
|
||||||
_episodeRepository = episodeRepository;
|
_episodeRepository = episodeRepository;
|
||||||
_eventAggregator = eventAggregator;
|
_messageAggregator = messageAggregator;
|
||||||
_configService = configService;
|
_configService = configService;
|
||||||
_seriesService = seriesService;
|
_seriesService = seriesService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@ -211,12 +211,12 @@ public void RefreshEpisodeInfo(Series series)
|
|||||||
|
|
||||||
if (newList.Any())
|
if (newList.Any())
|
||||||
{
|
{
|
||||||
_eventAggregator.Publish(new EpisodeInfoAddedEvent(newList));
|
_messageAggregator.Publish(new EpisodeInfoAddedEvent(newList));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateList.Any())
|
if (updateList.Any())
|
||||||
{
|
{
|
||||||
_eventAggregator.Publish(new EpisodeInfoUpdatedEvent(updateList));
|
_messageAggregator.Publish(new EpisodeInfoUpdatedEvent(updateList));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failCount != 0)
|
if (failCount != 0)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Tv.Events
|
namespace NzbDrone.Core.Tv.Events
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Tv.Events
|
namespace NzbDrone.Core.Tv.Events
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Tv.Events
|
namespace NzbDrone.Core.Tv.Events
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Tv.Events
|
namespace NzbDrone.Core.Tv.Events
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Tv.Events
|
namespace NzbDrone.Core.Tv.Events
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
@ -6,7 +6,7 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.EnsureThat;
|
using NzbDrone.Common.EnsureThat;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.MetadataSource;
|
using NzbDrone.Core.MetadataSource;
|
||||||
@ -41,19 +41,19 @@ public class SeriesService : ISeriesService, IHandleAsync<SeriesAddedEvent>
|
|||||||
private readonly ISeriesRepository _seriesRepository;
|
private readonly ISeriesRepository _seriesRepository;
|
||||||
private readonly IConfigService _configService;
|
private readonly IConfigService _configService;
|
||||||
private readonly IProvideSeriesInfo _seriesInfoProxy;
|
private readonly IProvideSeriesInfo _seriesInfoProxy;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IMessageAggregator _messageAggregator;
|
||||||
private readonly IRootFolderService _rootFolderService;
|
private readonly IRootFolderService _rootFolderService;
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService,
|
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService,
|
||||||
IProvideSeriesInfo seriesInfoProxy, IEventAggregator eventAggregator,
|
IProvideSeriesInfo seriesInfoProxy, IMessageAggregator messageAggregator,
|
||||||
IRootFolderService rootFolderService, DiskProvider diskProvider, Logger logger)
|
IRootFolderService rootFolderService, DiskProvider diskProvider, Logger logger)
|
||||||
{
|
{
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
_configService = configServiceService;
|
_configService = configServiceService;
|
||||||
_seriesInfoProxy = seriesInfoProxy;
|
_seriesInfoProxy = seriesInfoProxy;
|
||||||
_eventAggregator = eventAggregator;
|
_messageAggregator = messageAggregator;
|
||||||
_rootFolderService = rootFolderService;
|
_rootFolderService = rootFolderService;
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@ -83,7 +83,7 @@ public Series UpdateSeriesInfo(int seriesId)
|
|||||||
|
|
||||||
//Todo: We need to get the UtcOffset from TVRage, since its not available from trakt
|
//Todo: We need to get the UtcOffset from TVRage, since its not available from trakt
|
||||||
|
|
||||||
_eventAggregator.Publish(new SeriesUpdatedEvent(series));
|
_messageAggregator.Publish(new SeriesUpdatedEvent(series));
|
||||||
|
|
||||||
return series;
|
return series;
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ public Series AddSeries(Series newSeries)
|
|||||||
newSeries.BacklogSetting = BacklogSettingType.Inherit;
|
newSeries.BacklogSetting = BacklogSettingType.Inherit;
|
||||||
|
|
||||||
_seriesRepository.Insert(newSeries);
|
_seriesRepository.Insert(newSeries);
|
||||||
_eventAggregator.Publish(new SeriesAddedEvent(newSeries));
|
_messageAggregator.Publish(new SeriesAddedEvent(newSeries));
|
||||||
|
|
||||||
return newSeries;
|
return newSeries;
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ public void DeleteSeries(int seriesId, bool deleteFiles)
|
|||||||
{
|
{
|
||||||
var series = _seriesRepository.Get(seriesId);
|
var series = _seriesRepository.Get(seriesId);
|
||||||
_seriesRepository.Delete(seriesId);
|
_seriesRepository.Delete(seriesId);
|
||||||
_eventAggregator.Publish(new SeriesDeletedEvent(series, deleteFiles));
|
_messageAggregator.Publish(new SeriesDeletedEvent(series, deleteFiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Series> GetAllSeries()
|
public List<Series> GetAllSeries()
|
||||||
|
@ -29,9 +29,32 @@ public void should_have_no_root_folder_initially()
|
|||||||
RootFolders.Delete(postResponse.Id);
|
RootFolders.Delete(postResponse.Id);
|
||||||
|
|
||||||
RootFolders.All().Should().BeEmpty();
|
RootFolders.All().Should().BeEmpty();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestFixture]
|
||||||
|
public class QualityProfileIntegrationTest : IntegrationTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void should_have_2_quality_profiles_initially()
|
||||||
|
{
|
||||||
|
RootFolders.All().Should().BeEmpty();
|
||||||
|
|
||||||
|
var rootFolder = new RootFolderResource
|
||||||
|
{
|
||||||
|
Path = Directory.GetCurrentDirectory()
|
||||||
|
};
|
||||||
|
|
||||||
|
var postResponse = RootFolders.Post(rootFolder);
|
||||||
|
|
||||||
|
postResponse.Id.Should().NotBe(0);
|
||||||
|
postResponse.FreeSpace.Should().NotBe(0);
|
||||||
|
|
||||||
|
RootFolders.All().Should().OnlyContain(c => c.Id == postResponse.Id);
|
||||||
|
|
||||||
|
RootFolders.Delete(postResponse.Id);
|
||||||
|
|
||||||
|
RootFolders.All().Should().BeEmpty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,7 +34,7 @@ public void add_series_without_required_fields_should_return_badrequest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_be_able_to_add_series()
|
public void should_be_able_to_add_and_delete_series()
|
||||||
{
|
{
|
||||||
var series = Series.Lookup("archer").First();
|
var series = Series.Lookup("archer").First();
|
||||||
|
|
||||||
@ -45,6 +45,10 @@ public void should_be_able_to_add_series()
|
|||||||
Series.Post(series);
|
Series.Post(series);
|
||||||
|
|
||||||
Series.All().Should().HaveCount(1);
|
Series.All().Should().HaveCount(1);
|
||||||
|
|
||||||
|
Series.Delete(series.Id);
|
||||||
|
|
||||||
|
Series.All().Should().BeEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Test.Common.AutoMoq;
|
using NzbDrone.Test.Common.AutoMoq;
|
||||||
|
|
||||||
namespace NzbDrone.Test.Common
|
namespace NzbDrone.Test.Common
|
||||||
@ -122,12 +122,12 @@ protected void VerifyEventPublished<TEvent>() where TEvent : IEvent
|
|||||||
|
|
||||||
protected void VerifyEventPublished<TEvent>(Times times) where TEvent : IEvent
|
protected void VerifyEventPublished<TEvent>(Times times) where TEvent : IEvent
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IEventAggregator>().Verify(c => c.Publish(It.IsAny<TEvent>()), times);
|
Mocker.GetMock<IMessageAggregator>().Verify(c => c.Publish(It.IsAny<TEvent>()), times);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void VerifyEventNotPublished<TEvent>() where TEvent : IEvent
|
protected void VerifyEventNotPublished<TEvent>() where TEvent : IEvent
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IEventAggregator>().Verify(c => c.Publish(It.IsAny<TEvent>()), Times.Never());
|
Mocker.GetMock<IMessageAggregator>().Verify(c => c.Publish(It.IsAny<TEvent>()), Times.Never());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
using Nancy.Bootstrapper;
|
using Nancy.Bootstrapper;
|
||||||
using NzbDrone.Api;
|
using NzbDrone.Api;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Messaging;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
using NzbDrone.Core.ExternalNotification;
|
using NzbDrone.Core.ExternalNotification;
|
||||||
@ -29,7 +29,7 @@ private MainAppContainerBuilder()
|
|||||||
{
|
{
|
||||||
AutoRegisterImplementations<ExternalNotificationBase>();
|
AutoRegisterImplementations<ExternalNotificationBase>();
|
||||||
|
|
||||||
Container.Register<IEventAggregator, EventAggregator>().AsSingleton();
|
Container.Register<IMessageAggregator, MessageAggregator>().AsSingleton();
|
||||||
Container.Register<INancyBootstrapper, NancyBootstrapper>().AsSingleton();
|
Container.Register<INancyBootstrapper, NancyBootstrapper>().AsSingleton();
|
||||||
Container.Register<IAnnouncer, MigrationLogger>().AsSingleton();
|
Container.Register<IAnnouncer, MigrationLogger>().AsSingleton();
|
||||||
Container.Register<Router>().AsSingleton();
|
Container.Register<Router>().AsSingleton();
|
||||||
|
Loading…
Reference in New Issue
Block a user