From cfb7494992917e2a114710a8d3e80baf87aba017 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 2 Jul 2017 22:37:42 -0700 Subject: [PATCH] Removed Drone Factory --- .../Config/DownloadClientConfigModule.cs | 13 +---- .../Config/DownloadClientConfigResource.cs | 4 -- .../RootFolders/RootFolderModule.cs | 2 - src/NzbDrone.Api/Series/SeriesModule.cs | 2 - .../DiskSpace/DiskSpaceServiceFixture.cs | 29 ---------- .../CompletedDownloadServiceFixture.cs | 14 ----- .../PneumaticProviderFixture.cs | 13 ++--- .../Checks/DroneFactoryCheckFixture.cs | 54 ------------------- .../Checks/ImportMechanismCheckFixture.cs | 15 ------ ...DownloadedEpisodesCommandServiceFixture.cs | 30 +---------- .../NzbDrone.Core.Test.csproj | 1 - .../RootFolderServiceFixture.cs | 12 ----- .../Configuration/ConfigService.cs | 14 ----- .../Configuration/IConfigService.cs | 2 - .../DiskSpace/DiskSpaceService.cs | 8 --- .../Download/Clients/Pneumatic/Pneumatic.cs | 16 +----- .../rTorrent/RTorrentDirectoryValidator.cs | 2 - .../Clients/uTorrent/UTorrentResponse.cs | 2 + .../Download/CompletedDownloadService.cs | 8 --- .../Checks/DeprecatedDroneFactoryCheck.cs | 30 ----------- .../HealthCheck/Checks/DroneFactoryCheck.cs | 44 --------------- .../Checks/ImportMechanismCheck.cs | 22 +------- src/NzbDrone.Core/Jobs/TaskManager.cs | 16 ++---- .../DownloadedEpisodesCommandService.cs | 33 ++---------- src/NzbDrone.Core/NzbDrone.Core.csproj | 3 -- .../RootFolders/RootFolderService.cs | 5 -- src/NzbDrone.Core/Tv/AddSeriesValidator.cs | 2 - .../Validation/Paths/DroneFactoryValidator.cs | 28 ---------- .../Config/DownloadClientConfigModule.cs | 16 +----- .../Config/DownloadClientConfigResource.cs | 4 -- src/Sonarr.Api.V3/Series/SeriesModule.cs | 2 - 31 files changed, 25 insertions(+), 421 deletions(-) delete mode 100644 src/NzbDrone.Core.Test/HealthCheck/Checks/DroneFactoryCheckFixture.cs delete mode 100644 src/NzbDrone.Core/HealthCheck/Checks/DeprecatedDroneFactoryCheck.cs delete mode 100644 src/NzbDrone.Core/HealthCheck/Checks/DroneFactoryCheck.cs delete mode 100644 src/NzbDrone.Core/Validation/Paths/DroneFactoryValidator.cs diff --git a/src/NzbDrone.Api/Config/DownloadClientConfigModule.cs b/src/NzbDrone.Api/Config/DownloadClientConfigModule.cs index de478235e..27f4fc936 100644 --- a/src/NzbDrone.Api/Config/DownloadClientConfigModule.cs +++ b/src/NzbDrone.Api/Config/DownloadClientConfigModule.cs @@ -6,19 +6,10 @@ namespace NzbDrone.Api.Config { public class DownloadClientConfigModule : NzbDroneConfigModule { - public DownloadClientConfigModule(IConfigService configService, - RootFolderValidator rootFolderValidator, - PathExistsValidator pathExistsValidator, - MappedNetworkDriveValidator mappedNetworkDriveValidator) + public DownloadClientConfigModule(IConfigService configService) : base(configService) { - SharedValidator.RuleFor(c => c.DownloadedEpisodesFolder) - .Cascade(CascadeMode.StopOnFirstFailure) - .IsValidPath() - .SetValidator(rootFolderValidator) - .SetValidator(mappedNetworkDriveValidator) - .SetValidator(pathExistsValidator) - .When(c => !string.IsNullOrWhiteSpace(c.DownloadedEpisodesFolder)); + } protected override DownloadClientConfigResource ToResource(IConfigService model) diff --git a/src/NzbDrone.Api/Config/DownloadClientConfigResource.cs b/src/NzbDrone.Api/Config/DownloadClientConfigResource.cs index 0c4b00173..d0bf6f4a2 100644 --- a/src/NzbDrone.Api/Config/DownloadClientConfigResource.cs +++ b/src/NzbDrone.Api/Config/DownloadClientConfigResource.cs @@ -5,9 +5,7 @@ namespace NzbDrone.Api.Config { public class DownloadClientConfigResource : RestResource { - public string DownloadedEpisodesFolder { get; set; } public string DownloadClientWorkingFolders { get; set; } - public int DownloadedEpisodesScanInterval { get; set; } public bool EnableCompletedDownloadHandling { get; set; } public bool RemoveCompletedDownloads { get; set; } @@ -22,9 +20,7 @@ namespace NzbDrone.Api.Config { return new DownloadClientConfigResource { - DownloadedEpisodesFolder = model.DownloadedEpisodesFolder, DownloadClientWorkingFolders = model.DownloadClientWorkingFolders, - DownloadedEpisodesScanInterval = model.DownloadedEpisodesScanInterval, EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling, RemoveCompletedDownloads = model.RemoveCompletedDownloads, diff --git a/src/NzbDrone.Api/RootFolders/RootFolderModule.cs b/src/NzbDrone.Api/RootFolders/RootFolderModule.cs index 2581f4c35..581d0c97a 100644 --- a/src/NzbDrone.Api/RootFolders/RootFolderModule.cs +++ b/src/NzbDrone.Api/RootFolders/RootFolderModule.cs @@ -16,7 +16,6 @@ namespace NzbDrone.Api.RootFolders IBroadcastSignalRMessage signalRBroadcaster, RootFolderValidator rootFolderValidator, PathExistsValidator pathExistsValidator, - DroneFactoryValidator droneFactoryValidator, MappedNetworkDriveValidator mappedNetworkDriveValidator, StartupFolderValidator startupFolderValidator, SystemFolderValidator systemFolderValidator, @@ -35,7 +34,6 @@ namespace NzbDrone.Api.RootFolders .Cascade(CascadeMode.StopOnFirstFailure) .IsValidPath() .SetValidator(rootFolderValidator) - .SetValidator(droneFactoryValidator) .SetValidator(mappedNetworkDriveValidator) .SetValidator(startupFolderValidator) .SetValidator(pathExistsValidator) diff --git a/src/NzbDrone.Api/Series/SeriesModule.cs b/src/NzbDrone.Api/Series/SeriesModule.cs index be1558179..8ba82f518 100644 --- a/src/NzbDrone.Api/Series/SeriesModule.cs +++ b/src/NzbDrone.Api/Series/SeriesModule.cs @@ -48,7 +48,6 @@ namespace NzbDrone.Api.Series RootFolderValidator rootFolderValidator, SeriesPathValidator seriesPathValidator, SeriesExistsValidator seriesExistsValidator, - DroneFactoryValidator droneFactoryValidator, SeriesAncestorValidator seriesAncestorValidator, SystemFolderValidator systemFolderValidator, ProfileExistsValidator profileExistsValidator, @@ -78,7 +77,6 @@ namespace NzbDrone.Api.Series .IsValidPath() .SetValidator(rootFolderValidator) .SetValidator(seriesPathValidator) - .SetValidator(droneFactoryValidator) .SetValidator(seriesAncestorValidator) .SetValidator(systemFolderValidator) .When(s => !s.Path.IsNullOrWhiteSpace()); diff --git a/src/NzbDrone.Core.Test/DiskSpace/DiskSpaceServiceFixture.cs b/src/NzbDrone.Core.Test/DiskSpace/DiskSpaceServiceFixture.cs index ea92d5816..d07f0470b 100644 --- a/src/NzbDrone.Core.Test/DiskSpace/DiskSpaceServiceFixture.cs +++ b/src/NzbDrone.Core.Test/DiskSpace/DiskSpaceServiceFixture.cs @@ -102,35 +102,6 @@ namespace NzbDrone.Core.Test.DiskSpace .Verify(v => v.GetAvailableSpace(It.IsAny()), Times.Never()); } - [Test] - public void should_check_diskspace_for_dronefactory_folder() - { - Mocker.GetMock() - .SetupGet(v => v.DownloadedEpisodesFolder) - .Returns(_droneFactoryFolder); - - GivenExistingFolder(_droneFactoryFolder); - - var freeSpace = Subject.GetFreeSpace(); - - freeSpace.Should().NotBeEmpty(); - } - - [Test] - public void should_not_check_diskspace_for_missing_dronefactory_folder() - { - Mocker.GetMock() - .SetupGet(v => v.DownloadedEpisodesFolder) - .Returns(_droneFactoryFolder); - - var freeSpace = Subject.GetFreeSpace(); - - freeSpace.Should().BeEmpty(); - - Mocker.GetMock() - .Verify(v => v.GetAvailableSpace(It.IsAny()), Times.Never()); - } - [TestCase("/boot")] [TestCase("/var/lib/rancher")] [TestCase("/var/lib/rancher/volumes")] diff --git a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs index 3a1d29ba3..e99ff5968 100644 --- a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs @@ -151,20 +151,6 @@ namespace NzbDrone.Core.Test.Download AssertCompletedDownload(); } - [Test] - public void should_not_process_if_storage_directory_in_drone_factory() - { - Mocker.GetMock() - .SetupGet(v => v.DownloadedEpisodesFolder) - .Returns(@"C:\DropFolder".AsOsAgnostic()); - - _trackedDownload.DownloadItem.OutputPath = new OsPath(@"C:\DropFolder\SomeOtherFolder".AsOsAgnostic()); - - Subject.Process(_trackedDownload); - - AssertNoAttemptedImport(); - } - [Test] public void should_not_process_if_output_path_is_empty() { diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs index d3de3c1d9..0de6b66d8 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs @@ -1,10 +1,9 @@ -using System; +using System; using System.IO; using System.Net; using Moq; using NUnit.Framework; using NzbDrone.Common.Http; -using NzbDrone.Core.Configuration; using NzbDrone.Core.Download; using NzbDrone.Core.Download.Clients.Pneumatic; using NzbDrone.Core.Parser.Model; @@ -19,7 +18,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests private const string _nzbUrl = "http://www.nzbs.com/url"; private const string _title = "30.Rock.S01E05.hdtv.xvid-LoL"; private string _pneumaticFolder; - private string _sabDrop; + private string _strmFolder; private string _nzbPath; private RemoteEpisode _remoteEpisode; @@ -29,9 +28,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests _pneumaticFolder = @"d:\nzb\pneumatic\".AsOsAgnostic(); _nzbPath = Path.Combine(_pneumaticFolder, _title + ".nzb").AsOsAgnostic(); - _sabDrop = @"d:\unsorted tv\".AsOsAgnostic(); - - Mocker.GetMock().SetupGet(c => c.DownloadedEpisodesFolder).Returns(_sabDrop); + _strmFolder = @"d:\unsorted tv\".AsOsAgnostic(); _remoteEpisode = new RemoteEpisode(); _remoteEpisode.Release = new ReleaseInfo(); @@ -44,7 +41,8 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests Subject.Definition = new DownloadClientDefinition(); Subject.Definition.Settings = new PneumaticSettings { - NzbFolder = _pneumaticFolder + NzbFolder = _pneumaticFolder, + StrmFolder = _strmFolder }; } @@ -61,7 +59,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests Mocker.GetMock().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once()); } - [Test] public void should_throw_on_failed_download() { diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DroneFactoryCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DroneFactoryCheckFixture.cs deleted file mode 100644 index fbde84eb4..000000000 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DroneFactoryCheckFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Moq; -using NUnit.Framework; -using NzbDrone.Common.Disk; -using NzbDrone.Core.Configuration; -using NzbDrone.Core.HealthCheck.Checks; -using NzbDrone.Core.Test.Framework; - -namespace NzbDrone.Core.Test.HealthCheck.Checks -{ - [TestFixture] - public class DroneFactoryCheckFixture : CoreTest - { - private const string DRONE_FACTORY_FOLDER = @"C:\Test\Unsorted"; - - private void GivenDroneFactoryFolder(bool exists = false, bool writable = true) - { - Mocker.GetMock() - .SetupGet(s => s.DownloadedEpisodesFolder) - .Returns(DRONE_FACTORY_FOLDER); - - Mocker.GetMock() - .Setup(s => s.FolderExists(DRONE_FACTORY_FOLDER)) - .Returns(exists); - - Mocker.GetMock() - .Setup(s => s.FolderWritable(It.IsAny())) - .Returns(exists && writable); - } - - [Test] - public void should_return_error_when_drone_factory_folder_does_not_exist() - { - GivenDroneFactoryFolder(); - - Subject.Check().ShouldBeError(); - } - - [Test] - public void should_return_error_when_unable_to_write_to_drone_factory_folder() - { - GivenDroneFactoryFolder(true, false); - - Subject.Check().ShouldBeError(); - } - - [Test] - public void should_return_ok_when_no_issues_found() - { - GivenDroneFactoryFolder(true); - - Subject.Check().ShouldBeOk(); - } - } -} diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs index 5f0f3d9a0..e2704fc47 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/ImportMechanismCheckFixture.cs @@ -10,9 +10,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks [TestFixture] public class ImportMechanismCheckFixture : CoreTest { - private const string DRONE_FACTORY_FOLDER = @"C:\Test\Unsorted"; - - private void GivenCompletedDownloadHandling(bool? enabled = null) { if (enabled.HasValue) @@ -27,17 +24,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks } } - private void GivenDroneFactoryFolder(bool exists = false) - { - Mocker.GetMock() - .SetupGet(s => s.DownloadedEpisodesFolder) - .Returns(DRONE_FACTORY_FOLDER.AsOsAgnostic()); - - Mocker.GetMock() - .Setup(s => s.FolderExists(DRONE_FACTORY_FOLDER.AsOsAgnostic())) - .Returns(exists); - } - [Test] public void should_return_warning_when_completed_download_handling_not_configured() { @@ -56,7 +42,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks public void should_return_ok_when_no_issues_found() { GivenCompletedDownloadHandling(true); - GivenDroneFactoryFolder(true); Subject.Check().ShouldBeOk(); } diff --git a/src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesCommandServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesCommandServiceFixture.cs index 2ea63e183..7c614ff74 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesCommandServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesCommandServiceFixture.cs @@ -1,10 +1,10 @@ +using System; using System.Collections.Generic; using System.IO; using FizzWare.NBuilder; using Moq; using NUnit.Framework; using NzbDrone.Common.Disk; -using NzbDrone.Core.Configuration; using NzbDrone.Core.Download; using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.MediaFiles; @@ -20,7 +20,6 @@ namespace NzbDrone.Core.Test.MediaFiles [TestFixture] public class DownloadedEpisodesCommandServiceFixture : CoreTest { - private string _droneFactory = "c:\\drop\\".AsOsAgnostic(); private string _downloadFolder = "c:\\drop_other\\Show.S01E01\\".AsOsAgnostic(); private string _downloadFile = "c:\\drop_other\\Show.S01E01.mkv".AsOsAgnostic(); @@ -29,9 +28,6 @@ namespace NzbDrone.Core.Test.MediaFiles [SetUp] public void Setup() { - Mocker.GetMock().SetupGet(c => c.DownloadedEpisodesFolder) - .Returns(_droneFactory); - Mocker.GetMock() .Setup(v => v.ProcessRootFolder(It.IsAny())) .Returns(new List()); @@ -76,34 +72,12 @@ namespace NzbDrone.Core.Test.MediaFiles .Returns(_trackedDownload); } - [Test] - public void should_process_dronefactory_if_path_is_not_specified() - { - GivenExistingFolder(_droneFactory); - - Subject.Execute(new DownloadedEpisodesScanCommand()); - - Mocker.GetMock().Verify(c => c.ProcessRootFolder(It.IsAny()), Times.Once()); - } - [Test] public void should_skip_import_if_dronefactory_doesnt_exist() { - Subject.Execute(new DownloadedEpisodesScanCommand()); + Assert.Throws(() => Subject.Execute(new DownloadedEpisodesScanCommand())); Mocker.GetMock().Verify(c => c.ProcessRootFolder(It.IsAny()), Times.Never()); - - ExceptionVerification.ExpectedWarns(1); - } - - [Test] - public void should_ignore_downloadclientid_if_path_is_not_specified() - { - GivenExistingFolder(_droneFactory); - - Subject.Execute(new DownloadedEpisodesScanCommand() { DownloadClientId = "sab1" }); - - Mocker.GetMock().Verify(c => c.ProcessRootFolder(It.IsAny()), Times.Once()); } [Test] diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index cdc11717b..b3992b479 100644 --- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -239,7 +239,6 @@ - diff --git a/src/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs b/src/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs index 1f09c26d0..8e73d0c92 100644 --- a/src/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs +++ b/src/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs @@ -96,18 +96,6 @@ namespace NzbDrone.Core.Test.RootFolderTests Assert.Throws(() => Subject.Add(new RootFolder { Path = @"C:\TV".AsOsAgnostic() })); } - [Test] - public void should_throw_when_same_path_as_drone_factory() - { - var path = @"C:\TV".AsOsAgnostic(); - - Mocker.GetMock() - .SetupGet(s => s.DownloadedEpisodesFolder) - .Returns(path); - - Assert.Throws(() => Subject.Add(new RootFolder { Path = path })); -} - [TestCase("$recycle.bin")] [TestCase("system volume information")] [TestCase("recycler")] diff --git a/src/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs index d85151f6d..00870dfb7 100644 --- a/src/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -74,13 +74,6 @@ namespace NzbDrone.Core.Configuration return _repository.Get(key.ToLower()) != null; } - public string DownloadedEpisodesFolder - { - get { return GetValue(ConfigKey.DownloadedEpisodesFolder.ToString()); } - - set { SetValue(ConfigKey.DownloadedEpisodesFolder.ToString(), value); } - } - public bool AutoUnmonitorPreviouslyDownloadedEpisodes { get { return GetValueBoolean("AutoUnmonitorPreviouslyDownloadedEpisodes"); } @@ -181,13 +174,6 @@ namespace NzbDrone.Core.Configuration set { SetValue("DownloadClientWorkingFolders", value); } } - public int DownloadedEpisodesScanInterval - { - get { return GetValueInt("DownloadedEpisodesScanInterval", 1); } - - set { SetValue("DownloadedEpisodesScanInterval", value); } - } - public int DownloadClientHistoryLimit { get { return GetValueInt("DownloadClientHistoryLimit", 30); } diff --git a/src/NzbDrone.Core/Configuration/IConfigService.cs b/src/NzbDrone.Core/Configuration/IConfigService.cs index 7b4080148..17c3a6a17 100644 --- a/src/NzbDrone.Core/Configuration/IConfigService.cs +++ b/src/NzbDrone.Core/Configuration/IConfigService.cs @@ -11,9 +11,7 @@ namespace NzbDrone.Core.Configuration bool IsDefined(string key); //Download Client - string DownloadedEpisodesFolder { get; set; } string DownloadClientWorkingFolders { get; set; } - int DownloadedEpisodesScanInterval { get; set; } int DownloadClientHistoryLimit { get; set; } //Completed/Failed Download Handling (Download client) diff --git a/src/NzbDrone.Core/DiskSpace/DiskSpaceService.cs b/src/NzbDrone.Core/DiskSpace/DiskSpaceService.cs index f9371e01f..f2a1e95ed 100644 --- a/src/NzbDrone.Core/DiskSpace/DiskSpaceService.cs +++ b/src/NzbDrone.Core/DiskSpace/DiskSpaceService.cs @@ -48,14 +48,6 @@ namespace NzbDrone.Core.DiskSpace .Distinct(); } - private IEnumerable GetDroneFactoryRootPaths() - { - if (_configService.DownloadedEpisodesFolder.IsNotNullOrWhiteSpace() && _diskProvider.FolderExists(_configService.DownloadedEpisodesFolder)) - { - yield return _configService.DownloadedEpisodesFolder; - } - } - private IEnumerable GetFixedDisksRootPaths() { return _diskProvider.GetMounts() diff --git a/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs b/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs index c2ca17a63..00695b11f 100644 --- a/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs +++ b/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs @@ -121,25 +121,13 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic private string WriteStrmFile(string title, string nzbFile) { - string folder; - if (Settings.StrmFolder.IsNullOrWhiteSpace()) { - folder = _configService.DownloadedEpisodesFolder; - - if (folder.IsNullOrWhiteSpace()) - { - throw new DownloadClientException("Strm Folder needs to be set for Pneumatic Downloader"); - } - } - - else - { - folder = Settings.StrmFolder; + throw new DownloadClientException("Strm Folder needs to be set for Pneumatic Downloader"); } var contents = string.Format("plugin://plugin.program.pneumatic/?mode=strm&type=add_file&nzb={0}&nzbname={1}", nzbFile, title); - var filename = Path.Combine(folder, title + ".strm"); + var filename = Path.Combine(Settings.StrmFolder, title + ".strm"); _diskProvider.WriteAllText(filename, contents); diff --git a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentDirectoryValidator.cs b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentDirectoryValidator.cs index 3cb2d6a8b..872e71b28 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentDirectoryValidator.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentDirectoryValidator.cs @@ -15,13 +15,11 @@ namespace NzbDrone.Core.Download.Clients.rTorrent { public RTorrentDirectoryValidator(RootFolderValidator rootFolderValidator, PathExistsValidator pathExistsValidator, - DroneFactoryValidator droneFactoryValidator, MappedNetworkDriveValidator mappedNetworkDriveValidator) { RuleFor(c => c.TvDirectory).Cascade(CascadeMode.StopOnFirstFailure) .IsValidPath() .SetValidator(rootFolderValidator) - .SetValidator(droneFactoryValidator) .SetValidator(mappedNetworkDriveValidator) .SetValidator(pathExistsValidator) .When(c => c.TvDirectory.IsNotNullOrWhiteSpace()) diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentResponse.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentResponse.cs index 75551ea09..659e7f53c 100644 --- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentResponse.cs +++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentResponse.cs @@ -13,8 +13,10 @@ namespace NzbDrone.Core.Download.Clients.UTorrent [JsonProperty(PropertyName = "torrentp")] public List TorrentsChanged { get; set; } + [JsonProperty(PropertyName = "torrentm")] public List TorrentsRemoved { get; set; } + [JsonProperty(PropertyName = "torrentc")] public string CacheNumber { get; set; } diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index c4fbe11a2..8a638b27c 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -80,14 +80,6 @@ namespace NzbDrone.Core.Download return; } - var downloadedEpisodesFolder = new OsPath(_configService.DownloadedEpisodesFolder); - - if (downloadedEpisodesFolder.Contains(downloadItemOutputPath)) - { - trackedDownload.Warn("Intermediate Download path inside drone factory, Skipping."); - return; - } - var series = _parsingService.GetSeries(trackedDownload.DownloadItem.Title); if (series == null) diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DeprecatedDroneFactoryCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DeprecatedDroneFactoryCheck.cs deleted file mode 100644 index 2278cdc53..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/DeprecatedDroneFactoryCheck.cs +++ /dev/null @@ -1,30 +0,0 @@ -using NzbDrone.Common.Disk; -using NzbDrone.Common.Extensions; -using NzbDrone.Core.Configuration; -using NzbDrone.Core.Configuration.Events; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - [CheckOn(typeof(ConfigSavedEvent))] - public class DeprecatedDroneFactoryCheck : HealthCheckBase - { - private readonly IConfigService _configService; - - public DeprecatedDroneFactoryCheck(IConfigService configService) - { - _configService = configService; - } - - public override HealthCheck Check() - { - var droneFactoryFolder = _configService.DownloadedEpisodesFolder; - - if (droneFactoryFolder.IsNullOrWhiteSpace()) - { - return new HealthCheck(GetType()); - } - - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Drone Factory is deprecated and should not be used", "#drone-factory-is-deprecated"); - } - } -} diff --git a/src/NzbDrone.Core/HealthCheck/Checks/DroneFactoryCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/DroneFactoryCheck.cs deleted file mode 100644 index 2e7e51135..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/DroneFactoryCheck.cs +++ /dev/null @@ -1,44 +0,0 @@ -using NzbDrone.Common.Disk; -using NzbDrone.Common.Extensions; -using NzbDrone.Core.Configuration; -using NzbDrone.Core.Configuration.Events; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - [CheckOn(typeof(ConfigSavedEvent))] - public class DroneFactoryCheck : HealthCheckBase - { - private readonly IConfigService _configService; - private readonly IDiskProvider _diskProvider; - - public DroneFactoryCheck(IConfigService configService, IDiskProvider diskProvider) - { - _configService = configService; - _diskProvider = diskProvider; - } - - public override HealthCheck Check() - { - var droneFactoryFolder = _configService.DownloadedEpisodesFolder; - - if (droneFactoryFolder.IsNullOrWhiteSpace()) - { - return new HealthCheck(GetType()); - } - - if (!_diskProvider.FolderExists(droneFactoryFolder)) - { - return new HealthCheck(GetType(), HealthCheckResult.Error, "Drone factory folder does not exist"); - } - - if (!_diskProvider.FolderWritable(droneFactoryFolder)) - { - return new HealthCheck(GetType(), HealthCheckResult.Error, "Unable to write to drone factory folder"); - } - - //Todo: Unable to import one or more files/folders from - - return new HealthCheck(GetType()); - } - } -} diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs index 0ef0a3d0b..6d7bade17 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ImportMechanismCheck.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using NzbDrone.Common.Disk; using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Download; -using NzbDrone.Core.Download.Clients; using NzbDrone.Core.Download.Clients.Nzbget; using NzbDrone.Core.Download.Clients.Sabnzbd; using NzbDrone.Core.ThingiProvider.Events; @@ -29,7 +27,6 @@ namespace NzbDrone.Core.HealthCheck.Checks public override HealthCheck Check() { - var droneFactoryFolder = new OsPath(_configService.DownloadedEpisodesFolder); List downloadClients; try @@ -47,9 +44,6 @@ namespace NzbDrone.Core.HealthCheck.Checks } var downloadClientIsLocalHost = downloadClients.All(v => v.Status.IsLocalhost); - var downloadClientOutputInDroneFactory = !droneFactoryFolder.IsEmpty && - downloadClients.Any(v => v.Status.OutputRootFolders != null && - v.Status.OutputRootFolders.Any(droneFactoryFolder.Contains)); if (!_configService.IsDefined("EnableCompletedDownloadHandling")) { @@ -61,32 +55,20 @@ namespace NzbDrone.Core.HealthCheck.Checks if (downloadClients.All(v => v.DownloadClient is Sabnzbd)) { - // With Sabnzbd we can check if the category should be changed. - if (downloadClientOutputInDroneFactory) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Sabnzbd - Conflicting Category)", "Migrating-to-Completed-Download-Handling#sabnzbd-conflicting-download-client-category"); - } - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Sabnzbd)", "Migrating-to-Completed-Download-Handling#sabnzbd-enable-completed-download-handling"); } if (downloadClients.All(v => v.DownloadClient is Nzbget)) { - // With Nzbget we can check if the category should be changed. - if (downloadClientOutputInDroneFactory) - { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Nzbget - Conflicting Category)", "Migrating-to-Completed-Download-Handling#nzbget-conflicting-download-client-category"); - } - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Nzbget)", "Migrating-to-Completed-Download-Handling#nzbget-enable-completed-download-handling"); } return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible", "Migrating-to-Completed-Download-Handling"); } - if (!_configService.EnableCompletedDownloadHandling && droneFactoryFolder.IsEmpty) + if (!_configService.EnableCompletedDownloadHandling) { - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling or configure Drone factory"); + return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling"); } return new HealthCheck(GetType()); diff --git a/src/NzbDrone.Core/Jobs/TaskManager.cs b/src/NzbDrone.Core/Jobs/TaskManager.cs index 3ad7b909a..5756a1084 100644 --- a/src/NzbDrone.Core/Jobs/TaskManager.cs +++ b/src/NzbDrone.Core/Jobs/TaskManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using NLog; @@ -11,7 +11,6 @@ using NzbDrone.Core.HealthCheck; using NzbDrone.Core.Housekeeping; using NzbDrone.Core.Indexers; using NzbDrone.Core.Lifecycle; -using NzbDrone.Core.MediaFiles.Commands; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Tv.Commands; @@ -74,13 +73,7 @@ namespace NzbDrone.Core.Jobs { Interval = GetRssSyncInterval(), TypeName = typeof(RssSyncCommand).FullName - }, - - new ScheduledTask - { - Interval = _configService.DownloadedEpisodesScanInterval, - TypeName = typeof(DownloadedEpisodesScanCommand).FullName - }, + } }; var currentTasks = _scheduledTaskRepository.All().ToList(); @@ -144,10 +137,7 @@ namespace NzbDrone.Core.Jobs var rss = _scheduledTaskRepository.GetDefinition(typeof(RssSyncCommand)); rss.Interval = _configService.RssSyncInterval; - var downloadedEpisodes = _scheduledTaskRepository.GetDefinition(typeof(DownloadedEpisodesScanCommand)); - downloadedEpisodes.Interval = _configService.DownloadedEpisodesScanInterval; - - _scheduledTaskRepository.UpdateMany(new List { rss, downloadedEpisodes }); + _scheduledTaskRepository.Update(rss); } } } diff --git a/src/NzbDrone.Core/MediaFiles/DownloadedEpisodesCommandService.cs b/src/NzbDrone.Core/MediaFiles/DownloadedEpisodesCommandService.cs index 2f5e19a41..ca6543c8c 100644 --- a/src/NzbDrone.Core/MediaFiles/DownloadedEpisodesCommandService.cs +++ b/src/NzbDrone.Core/MediaFiles/DownloadedEpisodesCommandService.cs @@ -1,10 +1,10 @@ -using System.Collections.Generic; -using System.IO; +using System; +using System.Collections.Generic; using System.Linq; using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; -using NzbDrone.Core.Configuration; +using NzbDrone.Common.Instrumentation.Extensions; using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.MediaFiles.Commands; using NzbDrone.Core.MediaFiles.EpisodeImport; @@ -17,41 +17,19 @@ namespace NzbDrone.Core.MediaFiles private readonly IDownloadedEpisodesImportService _downloadedEpisodesImportService; private readonly ITrackedDownloadService _trackedDownloadService; private readonly IDiskProvider _diskProvider; - private readonly IConfigService _configService; private readonly Logger _logger; public DownloadedEpisodesCommandService(IDownloadedEpisodesImportService downloadedEpisodesImportService, ITrackedDownloadService trackedDownloadService, IDiskProvider diskProvider, - IConfigService configService, Logger logger) { _downloadedEpisodesImportService = downloadedEpisodesImportService; _trackedDownloadService = trackedDownloadService; _diskProvider = diskProvider; - _configService = configService; _logger = logger; } - private List ProcessDroneFactoryFolder() - { - var downloadedEpisodesFolder = _configService.DownloadedEpisodesFolder; - - if (string.IsNullOrEmpty(downloadedEpisodesFolder)) - { - _logger.Trace("Drone Factory folder is not configured"); - return new List(); - } - - if (!_diskProvider.FolderExists(downloadedEpisodesFolder)) - { - _logger.Warn("Drone Factory folder [{0}] doesn't exist.", downloadedEpisodesFolder); - return new List(); - } - - return _downloadedEpisodesImportService.ProcessRootFolder(new DirectoryInfo(downloadedEpisodesFolder)); - } - private List ProcessPath(DownloadedEpisodesScanCommand message) { if (!_diskProvider.FolderExists(message.Path) && !_diskProvider.FileExists(message.Path)) @@ -91,14 +69,13 @@ namespace NzbDrone.Core.MediaFiles } else { - importResults = ProcessDroneFactoryFolder(); + throw new ArgumentException("A path must be provided", "path"); } if (importResults == null || importResults.All(v => v.Result != ImportResultType.Imported)) { // Atm we don't report it as a command failure, coz that would cause the download to be failed. - // Changing the message won't do a thing either, coz it will get set to 'Completed' a msec later. - //message.SetMessage("Failed to import"); + _logger.ProgressDebug("Failed to import"); } } } diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 5411d6512..da5c693e5 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -600,11 +600,9 @@ - - @@ -1250,7 +1248,6 @@ - diff --git a/src/NzbDrone.Core/RootFolders/RootFolderService.cs b/src/NzbDrone.Core/RootFolders/RootFolderService.cs index 7f0d971bd..e0b48aaa1 100644 --- a/src/NzbDrone.Core/RootFolders/RootFolderService.cs +++ b/src/NzbDrone.Core/RootFolders/RootFolderService.cs @@ -104,11 +104,6 @@ namespace NzbDrone.Core.RootFolders throw new InvalidOperationException("Recent directory already exists."); } - if (_configService.DownloadedEpisodesFolder.IsNotNullOrWhiteSpace() && _configService.DownloadedEpisodesFolder.PathEquals(rootFolder.Path)) - { - throw new InvalidOperationException("Drone Factory folder cannot be used."); - } - if (!_diskProvider.FolderWritable(rootFolder.Path)) { throw new UnauthorizedAccessException(string.Format("Root folder path '{0}' is not writable by user '{1}'", rootFolder.Path, Environment.UserName)); diff --git a/src/NzbDrone.Core/Tv/AddSeriesValidator.cs b/src/NzbDrone.Core/Tv/AddSeriesValidator.cs index 418815be6..a9d1e2e75 100644 --- a/src/NzbDrone.Core/Tv/AddSeriesValidator.cs +++ b/src/NzbDrone.Core/Tv/AddSeriesValidator.cs @@ -13,7 +13,6 @@ namespace NzbDrone.Core.Tv { public AddSeriesValidator(RootFolderValidator rootFolderValidator, SeriesPathValidator seriesPathValidator, - DroneFactoryValidator droneFactoryValidator, SeriesAncestorValidator seriesAncestorValidator, SeriesTitleSlugValidator seriesTitleSlugValidator) { @@ -21,7 +20,6 @@ namespace NzbDrone.Core.Tv .IsValidPath() .SetValidator(rootFolderValidator) .SetValidator(seriesPathValidator) - .SetValidator(droneFactoryValidator) .SetValidator(seriesAncestorValidator); RuleFor(c => c.TitleSlug).SetValidator(seriesTitleSlugValidator); diff --git a/src/NzbDrone.Core/Validation/Paths/DroneFactoryValidator.cs b/src/NzbDrone.Core/Validation/Paths/DroneFactoryValidator.cs deleted file mode 100644 index cc2aec19c..000000000 --- a/src/NzbDrone.Core/Validation/Paths/DroneFactoryValidator.cs +++ /dev/null @@ -1,28 +0,0 @@ -using FluentValidation.Validators; -using NzbDrone.Common.Extensions; -using NzbDrone.Core.Configuration; - -namespace NzbDrone.Core.Validation.Paths -{ - public class DroneFactoryValidator : PropertyValidator - { - private readonly IConfigService _configService; - - public DroneFactoryValidator(IConfigService configService) - : base("Path is already used for drone factory") - { - _configService = configService; - } - - protected override bool IsValid(PropertyValidatorContext context) - { - if (context.PropertyValue == null) return false; - - var droneFactory = _configService.DownloadedEpisodesFolder; - - if (string.IsNullOrWhiteSpace(droneFactory)) return true; - - return !droneFactory.PathEquals(context.PropertyValue.ToString()); - } - } -} \ No newline at end of file diff --git a/src/Sonarr.Api.V3/Config/DownloadClientConfigModule.cs b/src/Sonarr.Api.V3/Config/DownloadClientConfigModule.cs index 08a2d5d06..223f25cab 100644 --- a/src/Sonarr.Api.V3/Config/DownloadClientConfigModule.cs +++ b/src/Sonarr.Api.V3/Config/DownloadClientConfigModule.cs @@ -1,24 +1,12 @@ -using FluentValidation; -using NzbDrone.Core.Configuration; -using NzbDrone.Core.Validation.Paths; +using NzbDrone.Core.Configuration; namespace Sonarr.Api.V3.Config { public class DownloadClientConfigModule : SonarrConfigModule { - public DownloadClientConfigModule(IConfigService configService, - RootFolderValidator rootFolderValidator, - PathExistsValidator pathExistsValidator, - MappedNetworkDriveValidator mappedNetworkDriveValidator) + public DownloadClientConfigModule(IConfigService configService) : base(configService) { - SharedValidator.RuleFor(c => c.DownloadedEpisodesFolder) - .Cascade(CascadeMode.StopOnFirstFailure) - .IsValidPath() - .SetValidator(rootFolderValidator) - .SetValidator(mappedNetworkDriveValidator) - .SetValidator(pathExistsValidator) - .When(c => !string.IsNullOrWhiteSpace(c.DownloadedEpisodesFolder)); } protected override DownloadClientConfigResource ToResource(IConfigService model) diff --git a/src/Sonarr.Api.V3/Config/DownloadClientConfigResource.cs b/src/Sonarr.Api.V3/Config/DownloadClientConfigResource.cs index 2bd371d5a..a749510b3 100644 --- a/src/Sonarr.Api.V3/Config/DownloadClientConfigResource.cs +++ b/src/Sonarr.Api.V3/Config/DownloadClientConfigResource.cs @@ -5,9 +5,7 @@ namespace Sonarr.Api.V3.Config { public class DownloadClientConfigResource : RestResource { - public string DownloadedEpisodesFolder { get; set; } public string DownloadClientWorkingFolders { get; set; } - public int DownloadedEpisodesScanInterval { get; set; } public bool EnableCompletedDownloadHandling { get; set; } public bool RemoveCompletedDownloads { get; set; } @@ -22,9 +20,7 @@ namespace Sonarr.Api.V3.Config { return new DownloadClientConfigResource { - DownloadedEpisodesFolder = model.DownloadedEpisodesFolder, DownloadClientWorkingFolders = model.DownloadClientWorkingFolders, - DownloadedEpisodesScanInterval = model.DownloadedEpisodesScanInterval, EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling, RemoveCompletedDownloads = model.RemoveCompletedDownloads, diff --git a/src/Sonarr.Api.V3/Series/SeriesModule.cs b/src/Sonarr.Api.V3/Series/SeriesModule.cs index d6c70cafe..fb39a39dc 100644 --- a/src/Sonarr.Api.V3/Series/SeriesModule.cs +++ b/src/Sonarr.Api.V3/Series/SeriesModule.cs @@ -52,7 +52,6 @@ namespace Sonarr.Api.V3.Series MappedNetworkDriveValidator mappedNetworkDriveValidator, SeriesPathValidator seriesPathValidator, SeriesExistsValidator seriesExistsValidator, - DroneFactoryValidator droneFactoryValidator, SeriesAncestorValidator seriesAncestorValidator, SystemFolderValidator systemFolderValidator, ProfileExistsValidator profileExistsValidator, @@ -83,7 +82,6 @@ namespace Sonarr.Api.V3.Series .SetValidator(rootFolderValidator) .SetValidator(mappedNetworkDriveValidator) .SetValidator(seriesPathValidator) - .SetValidator(droneFactoryValidator) .SetValidator(seriesAncestorValidator) .SetValidator(systemFolderValidator) .When(s => !s.Path.IsNullOrWhiteSpace());