diff --git a/NzbDrone.Core/MediaFiles/Commands/DiskScanCommand.cs b/NzbDrone.Core/MediaFiles/Commands/DiskScanCommand.cs deleted file mode 100644 index db7dd7a04..000000000 --- a/NzbDrone.Core/MediaFiles/Commands/DiskScanCommand.cs +++ /dev/null @@ -1,17 +0,0 @@ -using NzbDrone.Common.Messaging; - -namespace NzbDrone.Core.MediaFiles.Commands -{ - public class DiskScanCommand : ICommand - { - public int? SeriesId { get; private set; } - - public DiskScanCommand(int seriesId = 0) - { - if (seriesId != 0) - { - SeriesId = seriesId; - } - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/MediaFiles/DiskScanService.cs b/NzbDrone.Core/MediaFiles/DiskScanService.cs index 39e29d9f6..ceaae1165 100644 --- a/NzbDrone.Core/MediaFiles/DiskScanService.cs +++ b/NzbDrone.Core/MediaFiles/DiskScanService.cs @@ -7,8 +7,6 @@ using NzbDrone.Common.Messaging; using NzbDrone.Core.MediaFiles.Commands; using NzbDrone.Core.MediaFiles.EpisodeImport; -using NzbDrone.Core.Parser; -using NzbDrone.Core.Providers; using NzbDrone.Core.Tv; using NzbDrone.Core.Tv.Events; @@ -19,7 +17,9 @@ public interface IDiskScanService string[] GetVideoFiles(string path, bool allDirectories = true); } - public class DiskScanService : IDiskScanService, IExecute, IHandle + public class DiskScanService : + IDiskScanService, + IHandle { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly string[] MediaExtensions = new[] { ".mkv", ".avi", ".wmv", ".mp4", ".mpg", ".mpeg", ".xvid", ".flv", ".mov", ".rm", ".rmvb", ".divx", ".dvr-ms", ".ts", ".ogm", ".m4v", ".strm" }; @@ -31,7 +31,7 @@ public class DiskScanService : IDiskScanService, IExecute, IHan public DiskScanService(IDiskProvider diskProvider, ISeriesService seriesService, - IMakeImportDecision importDecisionMaker, + IMakeImportDecision importDecisionMaker, IImportApprovedEpisodes importApprovedEpisodes, IMessageAggregator messageAggregator) { @@ -45,7 +45,7 @@ public DiskScanService(IDiskProvider diskProvider, private void Scan(Series series) { _messageAggregator.PublishCommand(new CleanMediaFileDb(series.Id)); - + if (!_diskProvider.FolderExists(series.Path)) { Logger.Debug("Series folder doesn't exist: {0}", series.Path); @@ -71,33 +71,7 @@ public string[] GetVideoFiles(string path, bool allDirectories = true) return mediaFileList.ToArray(); } - public void Execute(DiskScanCommand message) - { - var seriesToScan = new List(); - - if (message.SeriesId.HasValue) - { - seriesToScan.Add(_seriesService.GetSeries(message.SeriesId.Value)); - } - else - { - seriesToScan.AddRange(_seriesService.GetAllSeries()); - } - - foreach (var series in seriesToScan) - { - try - { - Scan(series); - } - catch (Exception e) - { - Logger.ErrorException("Disk scan failed for " + series, e); - } - } - } - - public void Handle(EpisodeInfoAddedEvent message) + public void Handle(SeriesUpdatedEvent message) { Scan(message.Series); } diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index fe3380fa5..10ac72adb 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -275,7 +275,6 @@ -