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.MediaFiles.Commands;
using NzbDrone.Core.MediaFiles.EpisodeImport;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Tv;
@ -31,15 +32,17 @@ namespace NzbDrone.Core.MediaFiles
private readonly ICommandExecutor _commandExecutor;
private readonly IConfigService _configService;
private readonly ISeriesService _seriesService;
private readonly IEventAggregator _eventAggregator;
private readonly Logger _logger;
public DiskScanService(IDiskProvider diskProvider,
IMakeImportDecision importDecisionMaker,
IImportApprovedEpisodes importApprovedEpisodes,
ICommandExecutor commandExecutor,
IConfigService configService,
ISeriesService seriesService,
Logger logger)
IMakeImportDecision importDecisionMaker,
IImportApprovedEpisodes importApprovedEpisodes,
ICommandExecutor commandExecutor,
IConfigService configService,
ISeriesService seriesService,
IEventAggregator eventAggregator,
Logger logger)
{
_diskProvider = diskProvider;
_importDecisionMaker = importDecisionMaker;
@ -47,6 +50,7 @@ namespace NzbDrone.Core.MediaFiles
_commandExecutor = commandExecutor;
_configService = configService;
_seriesService = seriesService;
_eventAggregator = eventAggregator;
_logger = logger;
}
@ -75,7 +79,9 @@ namespace NzbDrone.Core.MediaFiles
var decisions = _importDecisionMaker.GetImportDecisions(mediaFileList, series, false);
_importApprovedEpisodes.Import(decisions);
_logger.Info("Completed scanning disk for {0}", series.Title);
_eventAggregator.PublishEvent(new SeriesScannedEvent(series));
}
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\EpisodeFileMoveResult.cs" />
<Compile Include="MediaFiles\EpisodeImport\Specifications\FullSeasonSpecification.cs" />
<Compile Include="MediaFiles\Events\SeriesScannedEvent.cs" />
<Compile Include="MediaFiles\MediaFileExtensions.cs" />
<Compile Include="MediaFiles\MediaInfo\VideoFileInfoReader.cs" />
<Compile Include="MediaFiles\RenameEpisodeFilePreview.cs" />