Added Series Scanned Event

This commit is contained in:
Mark McDowall 2014-03-08 10:35:48 -08:00
parent d0d5a3d3b1
commit 9d74693bb7
3 changed files with 28 additions and 6 deletions

View File

@ -8,6 +8,7 @@ using NzbDrone.Core.Configuration;
using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Instrumentation;
using NzbDrone.Core.MediaFiles.Commands; using NzbDrone.Core.MediaFiles.Commands;
using NzbDrone.Core.MediaFiles.EpisodeImport; using NzbDrone.Core.MediaFiles.EpisodeImport;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
@ -31,15 +32,17 @@ namespace NzbDrone.Core.MediaFiles
private readonly ICommandExecutor _commandExecutor; private readonly ICommandExecutor _commandExecutor;
private readonly IConfigService _configService; private readonly IConfigService _configService;
private readonly ISeriesService _seriesService; private readonly ISeriesService _seriesService;
private readonly IEventAggregator _eventAggregator;
private readonly Logger _logger; private readonly Logger _logger;
public DiskScanService(IDiskProvider diskProvider, public DiskScanService(IDiskProvider diskProvider,
IMakeImportDecision importDecisionMaker, IMakeImportDecision importDecisionMaker,
IImportApprovedEpisodes importApprovedEpisodes, IImportApprovedEpisodes importApprovedEpisodes,
ICommandExecutor commandExecutor, ICommandExecutor commandExecutor,
IConfigService configService, IConfigService configService,
ISeriesService seriesService, ISeriesService seriesService,
Logger logger) IEventAggregator eventAggregator,
Logger logger)
{ {
_diskProvider = diskProvider; _diskProvider = diskProvider;
_importDecisionMaker = importDecisionMaker; _importDecisionMaker = importDecisionMaker;
@ -47,6 +50,7 @@ namespace NzbDrone.Core.MediaFiles
_commandExecutor = commandExecutor; _commandExecutor = commandExecutor;
_configService = configService; _configService = configService;
_seriesService = seriesService; _seriesService = seriesService;
_eventAggregator = eventAggregator;
_logger = logger; _logger = logger;
} }
@ -75,7 +79,9 @@ namespace NzbDrone.Core.MediaFiles
var decisions = _importDecisionMaker.GetImportDecisions(mediaFileList, series, false); var decisions = _importDecisionMaker.GetImportDecisions(mediaFileList, series, false);
_importApprovedEpisodes.Import(decisions); _importApprovedEpisodes.Import(decisions);
_logger.Info("Completed scanning disk for {0}", series.Title); _logger.Info("Completed scanning disk for {0}", series.Title);
_eventAggregator.PublishEvent(new SeriesScannedEvent(series));
} }
public string[] GetVideoFiles(string path, bool allDirectories = true) public string[] GetVideoFiles(string path, bool allDirectories = true)

View File

@ -0,0 +1,15 @@
using NzbDrone.Common.Messaging;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.MediaFiles.Events
{
public class SeriesScannedEvent : IEvent
{
public Series Series { get; private set; }
public SeriesScannedEvent(Series series)
{
Series = series;
}
}
}

View File

@ -317,6 +317,7 @@
<Compile Include="MediaFiles\Commands\RenameFilesCommand.cs" /> <Compile Include="MediaFiles\Commands\RenameFilesCommand.cs" />
<Compile Include="MediaFiles\EpisodeFileMoveResult.cs" /> <Compile Include="MediaFiles\EpisodeFileMoveResult.cs" />
<Compile Include="MediaFiles\EpisodeImport\Specifications\FullSeasonSpecification.cs" /> <Compile Include="MediaFiles\EpisodeImport\Specifications\FullSeasonSpecification.cs" />
<Compile Include="MediaFiles\Events\SeriesScannedEvent.cs" />
<Compile Include="MediaFiles\MediaFileExtensions.cs" /> <Compile Include="MediaFiles\MediaFileExtensions.cs" />
<Compile Include="MediaFiles\MediaInfo\VideoFileInfoReader.cs" /> <Compile Include="MediaFiles\MediaInfo\VideoFileInfoReader.cs" />
<Compile Include="MediaFiles\RenameEpisodeFilePreview.cs" /> <Compile Include="MediaFiles\RenameEpisodeFilePreview.cs" />