1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

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
{
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));

View File

@ -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<RefreshSeriesCommand>, 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)
{