Call DiskScanService.Scan directly

This commit is contained in:
Mark McDowall 2014-03-21 22:32:57 -07:00
parent 69f5c8444e
commit f52c151f0a
2 changed files with 7 additions and 5 deletions

View File

@ -16,6 +16,7 @@ namespace NzbDrone.Core.MediaFiles
{ {
public interface IDiskScanService public interface IDiskScanService
{ {
void Scan(Series series);
string[] GetVideoFiles(string path, bool allDirectories = true); string[] GetVideoFiles(string path, bool allDirectories = true);
} }
@ -52,7 +53,7 @@ namespace NzbDrone.Core.MediaFiles
_logger = logger; _logger = logger;
} }
private void Scan(Series series) public void Scan(Series series)
{ {
_logger.ProgressInfo("Scanning disk for {0}", series.Title); _logger.ProgressInfo("Scanning disk for {0}", series.Title);
_commandExecutor.PublishCommand(new CleanMediaFileDb(series.Id)); _commandExecutor.PublishCommand(new CleanMediaFileDb(series.Id));

View File

@ -5,6 +5,7 @@ using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.DataAugmentation.DailySeries; using NzbDrone.Core.DataAugmentation.DailySeries;
using NzbDrone.Core.Instrumentation.Extensions; using NzbDrone.Core.Instrumentation.Extensions;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Commands; using NzbDrone.Core.MediaFiles.Commands;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
@ -22,7 +23,7 @@ namespace NzbDrone.Core.Tv
private readonly IRefreshEpisodeService _refreshEpisodeService; private readonly IRefreshEpisodeService _refreshEpisodeService;
private readonly IEventAggregator _eventAggregator; private readonly IEventAggregator _eventAggregator;
private readonly IDailySeriesService _dailySeriesService; private readonly IDailySeriesService _dailySeriesService;
private readonly ICommandExecutor _commandExecutor; private readonly IDiskScanService _diskScanService;
private readonly ICheckIfSeriesShouldBeRefreshed _checkIfSeriesShouldBeRefreshed; private readonly ICheckIfSeriesShouldBeRefreshed _checkIfSeriesShouldBeRefreshed;
private readonly Logger _logger; private readonly Logger _logger;
@ -31,7 +32,7 @@ namespace NzbDrone.Core.Tv
IRefreshEpisodeService refreshEpisodeService, IRefreshEpisodeService refreshEpisodeService,
IEventAggregator eventAggregator, IEventAggregator eventAggregator,
IDailySeriesService dailySeriesService, IDailySeriesService dailySeriesService,
ICommandExecutor commandExecutor, IDiskScanService diskScanService,
ICheckIfSeriesShouldBeRefreshed checkIfSeriesShouldBeRefreshed, ICheckIfSeriesShouldBeRefreshed checkIfSeriesShouldBeRefreshed,
Logger logger) Logger logger)
{ {
@ -40,7 +41,7 @@ namespace NzbDrone.Core.Tv
_refreshEpisodeService = refreshEpisodeService; _refreshEpisodeService = refreshEpisodeService;
_eventAggregator = eventAggregator; _eventAggregator = eventAggregator;
_dailySeriesService = dailySeriesService; _dailySeriesService = dailySeriesService;
_commandExecutor = commandExecutor; _diskScanService = diskScanService;
_checkIfSeriesShouldBeRefreshed = checkIfSeriesShouldBeRefreshed; _checkIfSeriesShouldBeRefreshed = checkIfSeriesShouldBeRefreshed;
_logger = logger; _logger = logger;
} }
@ -145,7 +146,7 @@ namespace NzbDrone.Core.Tv
try try
{ {
_logger.Info("Skipping refresh of series: {0}", series.Title); _logger.Info("Skipping refresh of series: {0}", series.Title);
_commandExecutor.PublishCommand(new RescanSeriesCommand(series.Id)); _diskScanService.Scan(series);
} }
catch (Exception e) catch (Exception e)
{ {