Rename DownloadedEpisodesScan to DownloadedAlbumsScan (#71)

* Rename DownloadedEpisodesScan to DownloadedAlbumsScan

* Rename Command Service
pull/41/head
Qstick 7 years ago committed by GitHub
parent 2c42fc19e5
commit e405cc9cf0

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
@ -9,7 +9,6 @@ using NzbDrone.Core.Download;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Commands; using NzbDrone.Core.MediaFiles.Commands;
using NzbDrone.Core.MediaFiles.EpisodeImport;
using NzbDrone.Core.MediaFiles.TrackImport; using NzbDrone.Core.MediaFiles.TrackImport;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -19,7 +18,7 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.MediaFiles namespace NzbDrone.Core.Test.MediaFiles
{ {
[TestFixture] [TestFixture]
public class DownloadedEpisodesCommandServiceFixture : CoreTest<DownloadedEpisodesCommandService> public class DownloadedAlbumsCommandServiceFixture : CoreTest<DownloadedAlbumsCommandService>
{ {
private string _droneFactory = "c:\\drop\\".AsOsAgnostic(); private string _droneFactory = "c:\\drop\\".AsOsAgnostic();
private string _downloadFolder = "c:\\drop_other\\Show.S01E01\\".AsOsAgnostic(); private string _downloadFolder = "c:\\drop_other\\Show.S01E01\\".AsOsAgnostic();
@ -82,7 +81,7 @@ namespace NzbDrone.Core.Test.MediaFiles
{ {
GivenExistingFolder(_droneFactory); GivenExistingFolder(_droneFactory);
Subject.Execute(new DownloadedEpisodesScanCommand()); Subject.Execute(new DownloadedAlbumsScanCommand());
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Once()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Once());
} }
@ -90,7 +89,7 @@ namespace NzbDrone.Core.Test.MediaFiles
[Test] [Test]
public void should_skip_import_if_dronefactory_doesnt_exist() public void should_skip_import_if_dronefactory_doesnt_exist()
{ {
Subject.Execute(new DownloadedEpisodesScanCommand()); Subject.Execute(new DownloadedAlbumsScanCommand());
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Never()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Never());
@ -102,7 +101,7 @@ namespace NzbDrone.Core.Test.MediaFiles
{ {
GivenExistingFolder(_droneFactory); GivenExistingFolder(_droneFactory);
Subject.Execute(new DownloadedEpisodesScanCommand() { DownloadClientId = "sab1" }); Subject.Execute(new DownloadedAlbumsScanCommand() { DownloadClientId = "sab1" });
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Once()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Once());
} }
@ -112,7 +111,7 @@ namespace NzbDrone.Core.Test.MediaFiles
{ {
GivenExistingFolder(_downloadFolder); GivenExistingFolder(_downloadFolder);
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFolder }); Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder });
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once());
} }
@ -122,7 +121,7 @@ namespace NzbDrone.Core.Test.MediaFiles
{ {
GivenExistingFile(_downloadFile); GivenExistingFile(_downloadFile);
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFile }); Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFile });
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once());
} }
@ -133,7 +132,7 @@ namespace NzbDrone.Core.Test.MediaFiles
GivenExistingFolder(_downloadFolder); GivenExistingFolder(_downloadFolder);
GivenValidQueueItem(); GivenValidQueueItem();
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" }); Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, _trackedDownload.RemoteEpisode.Series, _trackedDownload.DownloadItem), Times.Once()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, _trackedDownload.RemoteEpisode.Series, _trackedDownload.DownloadItem), Times.Once());
} }
@ -143,7 +142,7 @@ namespace NzbDrone.Core.Test.MediaFiles
{ {
GivenExistingFolder(_downloadFolder); GivenExistingFolder(_downloadFolder);
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" }); Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, null, null), Times.Once()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, null, null), Times.Once());
@ -153,7 +152,7 @@ namespace NzbDrone.Core.Test.MediaFiles
[Test] [Test]
public void should_warn_if_neither_folder_or_file_exists() public void should_warn_if_neither_folder_or_file_exists()
{ {
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFolder }); Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder });
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Never()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Never());
@ -165,7 +164,7 @@ namespace NzbDrone.Core.Test.MediaFiles
{ {
GivenExistingFile(_downloadFile); GivenExistingFile(_downloadFile);
Subject.Execute(new DownloadedEpisodesScanCommand() { Path = _downloadFile, ImportMode = ImportMode.Copy }); Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFile, ImportMode = ImportMode.Copy });
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Copy, null, null), Times.Once()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Copy, null, null), Times.Once());
} }

@ -15,8 +15,8 @@ namespace NzbDrone.Core.Test.Messaging.Commands
[Test] [Test]
public void should_return_true_when_there_are_no_properties() public void should_return_true_when_there_are_no_properties()
{ {
var command1 = new DownloadedEpisodesScanCommand(); var command1 = new DownloadedAlbumsScanCommand();
var command2 = new DownloadedEpisodesScanCommand(); var command2 = new DownloadedAlbumsScanCommand();
CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeTrue(); CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeTrue();
} }

@ -278,7 +278,7 @@
<Compile Include="MediaCoverTests\ImageResizerFixture.cs" /> <Compile Include="MediaCoverTests\ImageResizerFixture.cs" />
<Compile Include="MediaCoverTests\MediaCoverServiceFixture.cs" /> <Compile Include="MediaCoverTests\MediaCoverServiceFixture.cs" />
<Compile Include="MediaFiles\DiskScanServiceTests\ScanFixture.cs" /> <Compile Include="MediaFiles\DiskScanServiceTests\ScanFixture.cs" />
<Compile Include="MediaFiles\DownloadedEpisodesCommandServiceFixture.cs" /> <Compile Include="MediaFiles\DownloadedAlbumsCommandServiceFixture.cs" />
<Compile Include="MediaFiles\DownloadedEpisodesImportServiceFixture.cs" /> <Compile Include="MediaFiles\DownloadedEpisodesImportServiceFixture.cs" />
<Compile Include="MediaFiles\MediaInfo\MediaInfoFormatterTests\FormatAudioCodecFixture.cs" /> <Compile Include="MediaFiles\MediaInfo\MediaInfoFormatterTests\FormatAudioCodecFixture.cs" />
<Compile Include="MediaFiles\TrackFileMovingServiceTests\MoveTrackFileFixture.cs" /> <Compile Include="MediaFiles\TrackFileMovingServiceTests\MoveTrackFileFixture.cs" />

@ -79,7 +79,7 @@ namespace NzbDrone.Core.Jobs
new ScheduledTask new ScheduledTask
{ {
Interval = _configService.DownloadedAlbumsScanInterval, Interval = _configService.DownloadedAlbumsScanInterval,
TypeName = typeof(DownloadedEpisodesScanCommand).FullName TypeName = typeof(DownloadedAlbumsScanCommand).FullName
}, },
}; };
@ -144,7 +144,7 @@ namespace NzbDrone.Core.Jobs
var rss = _scheduledTaskRepository.GetDefinition(typeof(RssSyncCommand)); var rss = _scheduledTaskRepository.GetDefinition(typeof(RssSyncCommand));
rss.Interval = _configService.RssSyncInterval; rss.Interval = _configService.RssSyncInterval;
var downloadedAlbums = _scheduledTaskRepository.GetDefinition(typeof(DownloadedEpisodesScanCommand)); var downloadedAlbums = _scheduledTaskRepository.GetDefinition(typeof(DownloadedAlbumsScanCommand));
downloadedAlbums.Interval = _configService.DownloadedAlbumsScanInterval; downloadedAlbums.Interval = _configService.DownloadedAlbumsScanInterval;
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, downloadedAlbums }); _scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, downloadedAlbums });

@ -1,10 +1,9 @@
using NzbDrone.Core.MediaFiles.EpisodeImport;
using NzbDrone.Core.MediaFiles.TrackImport; using NzbDrone.Core.MediaFiles.TrackImport;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
namespace NzbDrone.Core.MediaFiles.Commands namespace NzbDrone.Core.MediaFiles.Commands
{ {
public class DownloadedEpisodesScanCommand : Command public class DownloadedAlbumsScanCommand : Command
{ {
public override bool SendUpdatesToClient => SendUpdates; public override bool SendUpdatesToClient => SendUpdates;

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using NLog; using NLog;
@ -7,13 +7,12 @@ using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.MediaFiles.Commands; using NzbDrone.Core.MediaFiles.Commands;
using NzbDrone.Core.MediaFiles.EpisodeImport;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.MediaFiles.TrackImport; using NzbDrone.Core.MediaFiles.TrackImport;
namespace NzbDrone.Core.MediaFiles namespace NzbDrone.Core.MediaFiles
{ {
public class DownloadedEpisodesCommandService : IExecute<DownloadedEpisodesScanCommand> public class DownloadedAlbumsCommandService : IExecute<DownloadedAlbumsScanCommand>
{ {
private readonly IDownloadedEpisodesImportService _downloadedEpisodesImportService; private readonly IDownloadedEpisodesImportService _downloadedEpisodesImportService;
private readonly ITrackedDownloadService _trackedDownloadService; private readonly ITrackedDownloadService _trackedDownloadService;
@ -21,7 +20,7 @@ namespace NzbDrone.Core.MediaFiles
private readonly IConfigService _configService; private readonly IConfigService _configService;
private readonly Logger _logger; private readonly Logger _logger;
public DownloadedEpisodesCommandService(IDownloadedEpisodesImportService downloadedEpisodesImportService, public DownloadedAlbumsCommandService(IDownloadedEpisodesImportService downloadedEpisodesImportService,
ITrackedDownloadService trackedDownloadService, ITrackedDownloadService trackedDownloadService,
IDiskProvider diskProvider, IDiskProvider diskProvider,
IConfigService configService, IConfigService configService,
@ -53,7 +52,7 @@ namespace NzbDrone.Core.MediaFiles
return _downloadedEpisodesImportService.ProcessRootFolder(new DirectoryInfo(downloadedAlbumsFolder)); return _downloadedEpisodesImportService.ProcessRootFolder(new DirectoryInfo(downloadedAlbumsFolder));
} }
private List<ImportResult> ProcessPath(DownloadedEpisodesScanCommand message) private List<ImportResult> ProcessPath(DownloadedAlbumsScanCommand message)
{ {
if (!_diskProvider.FolderExists(message.Path) && !_diskProvider.FileExists(message.Path)) if (!_diskProvider.FolderExists(message.Path) && !_diskProvider.FileExists(message.Path))
{ {
@ -82,7 +81,7 @@ namespace NzbDrone.Core.MediaFiles
return _downloadedEpisodesImportService.ProcessPath(message.Path, message.ImportMode); return _downloadedEpisodesImportService.ProcessPath(message.Path, message.ImportMode);
} }
public void Execute(DownloadedEpisodesScanCommand message) public void Execute(DownloadedAlbumsScanCommand message)
{ {
List<ImportResult> importResults; List<ImportResult> importResults;

@ -720,7 +720,7 @@
<Compile Include="MediaCover\MediaCoversUpdatedEvent.cs" /> <Compile Include="MediaCover\MediaCoversUpdatedEvent.cs" />
<Compile Include="MediaFiles\Commands\BackendCommandAttribute.cs" /> <Compile Include="MediaFiles\Commands\BackendCommandAttribute.cs" />
<Compile Include="MediaFiles\Commands\CleanUpRecycleBinCommand.cs" /> <Compile Include="MediaFiles\Commands\CleanUpRecycleBinCommand.cs" />
<Compile Include="MediaFiles\Commands\DownloadedEpisodesScanCommand.cs" /> <Compile Include="MediaFiles\Commands\DownloadedAlbumsScanCommand.cs" />
<Compile Include="MediaFiles\Commands\RenameArtistCommand.cs" /> <Compile Include="MediaFiles\Commands\RenameArtistCommand.cs" />
<Compile Include="MediaFiles\Events\EpisodeFolderCreatedEvent.cs" /> <Compile Include="MediaFiles\Events\EpisodeFolderCreatedEvent.cs" />
<Compile Include="MediaFiles\Events\TrackFolderCreatedEvent.cs" /> <Compile Include="MediaFiles\Events\TrackFolderCreatedEvent.cs" />
@ -741,7 +741,7 @@
<Compile Include="MediaFiles\DownloadedEpisodesImportService.cs"> <Compile Include="MediaFiles\DownloadedEpisodesImportService.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="MediaFiles\DownloadedEpisodesCommandService.cs" /> <Compile Include="MediaFiles\DownloadedAlbumsCommandService.cs" />
<Compile Include="MediaFiles\EpisodeFile.cs" /> <Compile Include="MediaFiles\EpisodeFile.cs" />
<Compile Include="MediaFiles\EpisodeImport\IImportDecisionEngineSpecification.cs" /> <Compile Include="MediaFiles\EpisodeImport\IImportDecisionEngineSpecification.cs" />
<Compile Include="MediaFiles\EpisodeImport\ImportApprovedEpisodes.cs" /> <Compile Include="MediaFiles\EpisodeImport\ImportApprovedEpisodes.cs" />

@ -161,8 +161,8 @@ module.exports = Marionette.Layout.extend({
}, },
_automaticImport : function (e) { _automaticImport : function (e) {
CommandController.Execute('downloadedEpisodesScan', { CommandController.Execute('downloadedAlbumsScan', {
name : 'downloadedEpisodesScan', name : 'downloadedAlbumsScan',
path : e.folder path : e.folder
}); });

@ -133,7 +133,7 @@ module.exports = Marionette.Layout.extend({
{ {
title : 'Rescan Drone Factory Folder', title : 'Rescan Drone Factory Folder',
icon : 'icon-lidarr-refresh', icon : 'icon-lidarr-refresh',
command : 'downloadedepisodesscan', command : 'downloadedalbumsscan',
properties : { sendUpdates : true } properties : { sendUpdates : true }
}, },
{ {

Loading…
Cancel
Save