From f52c151f0af2a3851cb2b9fa35248302c8903b4a Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 21 Mar 2014 22:32:57 -0700 Subject: [PATCH] Call DiskScanService.Scan directly --- src/NzbDrone.Core/MediaFiles/DiskScanService.cs | 3 ++- src/NzbDrone.Core/Tv/RefreshSeriesService.cs | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs index c03e8ec0d..5f8cb9fa8 100644 --- a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs +++ b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs @@ -16,6 +16,7 @@ namespace NzbDrone.Core.MediaFiles { public interface IDiskScanService { + void Scan(Series series); string[] GetVideoFiles(string path, bool allDirectories = true); } @@ -52,7 +53,7 @@ public DiskScanService(IDiskProvider diskProvider, _logger = logger; } - private void Scan(Series series) + public void Scan(Series series) { _logger.ProgressInfo("Scanning disk for {0}", series.Title); _commandExecutor.PublishCommand(new CleanMediaFileDb(series.Id)); diff --git a/src/NzbDrone.Core/Tv/RefreshSeriesService.cs b/src/NzbDrone.Core/Tv/RefreshSeriesService.cs index b7b455048..81b2f6ae8 100644 --- a/src/NzbDrone.Core/Tv/RefreshSeriesService.cs +++ b/src/NzbDrone.Core/Tv/RefreshSeriesService.cs @@ -5,6 +5,7 @@ using NLog; using NzbDrone.Core.DataAugmentation.DailySeries; using NzbDrone.Core.Instrumentation.Extensions; +using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles.Commands; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Events; @@ -22,7 +23,7 @@ public class RefreshSeriesService : IExecute, IHandleAsync private readonly IRefreshEpisodeService _refreshEpisodeService; private readonly IEventAggregator _eventAggregator; private readonly IDailySeriesService _dailySeriesService; - private readonly ICommandExecutor _commandExecutor; + private readonly IDiskScanService _diskScanService; private readonly ICheckIfSeriesShouldBeRefreshed _checkIfSeriesShouldBeRefreshed; private readonly Logger _logger; @@ -31,7 +32,7 @@ public RefreshSeriesService(IProvideSeriesInfo seriesInfo, IRefreshEpisodeService refreshEpisodeService, IEventAggregator eventAggregator, IDailySeriesService dailySeriesService, - ICommandExecutor commandExecutor, + IDiskScanService diskScanService, ICheckIfSeriesShouldBeRefreshed checkIfSeriesShouldBeRefreshed, Logger logger) { @@ -40,7 +41,7 @@ public RefreshSeriesService(IProvideSeriesInfo seriesInfo, _refreshEpisodeService = refreshEpisodeService; _eventAggregator = eventAggregator; _dailySeriesService = dailySeriesService; - _commandExecutor = commandExecutor; + _diskScanService = diskScanService; _checkIfSeriesShouldBeRefreshed = checkIfSeriesShouldBeRefreshed; _logger = logger; } @@ -145,7 +146,7 @@ public void Execute(RefreshSeriesCommand message) try { _logger.Info("Skipping refresh of series: {0}", series.Title); - _commandExecutor.PublishCommand(new RescanSeriesCommand(series.Id)); + _diskScanService.Scan(series); } catch (Exception e) {