From 4456d3cbe085eba31c43f85856e299963c66093d Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 13 Jul 2013 13:21:34 -0700 Subject: [PATCH] fixed disk not being scanned during series refresh. --- .../MediaFiles/Commands/DiskScanCommand.cs | 17 --------- NzbDrone.Core/MediaFiles/DiskScanService.cs | 38 +++---------------- NzbDrone.Core/NzbDrone.Core.csproj | 1 - 3 files changed, 6 insertions(+), 50 deletions(-) delete mode 100644 NzbDrone.Core/MediaFiles/Commands/DiskScanCommand.cs 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; 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 @@ namespace NzbDrone.Core.MediaFiles 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 @@ namespace NzbDrone.Core.MediaFiles public DiskScanService(IDiskProvider diskProvider, ISeriesService seriesService, - IMakeImportDecision importDecisionMaker, + IMakeImportDecision importDecisionMaker, IImportApprovedEpisodes importApprovedEpisodes, IMessageAggregator messageAggregator) { @@ -45,7 +45,7 @@ namespace NzbDrone.Core.MediaFiles 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 @@ namespace NzbDrone.Core.MediaFiles 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 @@ -