diff --git a/src/NzbDrone.Core/MediaFiles/Commands/RescanSeriesCommand.cs b/src/NzbDrone.Core/MediaFiles/Commands/RescanSeriesCommand.cs new file mode 100644 index 000000000..81ee0951f --- /dev/null +++ b/src/NzbDrone.Core/MediaFiles/Commands/RescanSeriesCommand.cs @@ -0,0 +1,17 @@ +using NzbDrone.Core.Messaging.Commands; + +namespace NzbDrone.Core.MediaFiles.Commands +{ + public class RescanSeriesCommand : Command + { + public int SeriesId { get; set; } + + public override bool SendUpdatesToClient + { + get + { + return true; + } + } + } +} \ No newline at end of file diff --git a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs index 6c237fa6d..0b1e51be6 100644 --- a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs +++ b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using System.Linq; using NLog; using NzbDrone.Common; @@ -21,13 +22,15 @@ public interface IDiskScanService public class DiskScanService : IDiskScanService, - IHandle + IHandle, + IExecute { private readonly IDiskProvider _diskProvider; private readonly IMakeImportDecision _importDecisionMaker; private readonly IImportApprovedEpisodes _importApprovedEpisodes; private readonly ICommandExecutor _commandExecutor; private readonly IConfigService _configService; + private readonly ISeriesService _seriesService; private readonly Logger _logger; public DiskScanService(IDiskProvider diskProvider, @@ -35,6 +38,7 @@ public DiskScanService(IDiskProvider diskProvider, IImportApprovedEpisodes importApprovedEpisodes, ICommandExecutor commandExecutor, IConfigService configService, + ISeriesService seriesService, Logger logger) { _diskProvider = diskProvider; @@ -42,6 +46,7 @@ public DiskScanService(IDiskProvider diskProvider, _importApprovedEpisodes = importApprovedEpisodes; _commandExecutor = commandExecutor; _configService = configService; + _seriesService = seriesService; _logger = logger; } @@ -90,5 +95,12 @@ public void Handle(SeriesUpdatedEvent message) { Scan(message.Series); } + + public void Execute(RescanSeriesCommand message) + { + var series = _seriesService.GetSeries(message.SeriesId); + + Scan(series); + } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 16b44a898..f52c84c8c 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -289,6 +289,7 @@ +