Removed Drone Factory

This commit is contained in:
Mark McDowall 2017-07-02 22:37:42 -07:00 committed by Taloth Saldono
parent f31ac39e37
commit cfb7494992
31 changed files with 25 additions and 421 deletions

View File

@ -6,19 +6,10 @@ namespace NzbDrone.Api.Config
{ {
public class DownloadClientConfigModule : NzbDroneConfigModule<DownloadClientConfigResource> public class DownloadClientConfigModule : NzbDroneConfigModule<DownloadClientConfigResource>
{ {
public DownloadClientConfigModule(IConfigService configService, public DownloadClientConfigModule(IConfigService configService)
RootFolderValidator rootFolderValidator,
PathExistsValidator pathExistsValidator,
MappedNetworkDriveValidator mappedNetworkDriveValidator)
: base(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) protected override DownloadClientConfigResource ToResource(IConfigService model)

View File

@ -5,9 +5,7 @@ namespace NzbDrone.Api.Config
{ {
public class DownloadClientConfigResource : RestResource public class DownloadClientConfigResource : RestResource
{ {
public string DownloadedEpisodesFolder { get; set; }
public string DownloadClientWorkingFolders { get; set; } public string DownloadClientWorkingFolders { get; set; }
public int DownloadedEpisodesScanInterval { get; set; }
public bool EnableCompletedDownloadHandling { get; set; } public bool EnableCompletedDownloadHandling { get; set; }
public bool RemoveCompletedDownloads { get; set; } public bool RemoveCompletedDownloads { get; set; }
@ -22,9 +20,7 @@ namespace NzbDrone.Api.Config
{ {
return new DownloadClientConfigResource return new DownloadClientConfigResource
{ {
DownloadedEpisodesFolder = model.DownloadedEpisodesFolder,
DownloadClientWorkingFolders = model.DownloadClientWorkingFolders, DownloadClientWorkingFolders = model.DownloadClientWorkingFolders,
DownloadedEpisodesScanInterval = model.DownloadedEpisodesScanInterval,
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling, EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
RemoveCompletedDownloads = model.RemoveCompletedDownloads, RemoveCompletedDownloads = model.RemoveCompletedDownloads,

View File

@ -16,7 +16,6 @@ namespace NzbDrone.Api.RootFolders
IBroadcastSignalRMessage signalRBroadcaster, IBroadcastSignalRMessage signalRBroadcaster,
RootFolderValidator rootFolderValidator, RootFolderValidator rootFolderValidator,
PathExistsValidator pathExistsValidator, PathExistsValidator pathExistsValidator,
DroneFactoryValidator droneFactoryValidator,
MappedNetworkDriveValidator mappedNetworkDriveValidator, MappedNetworkDriveValidator mappedNetworkDriveValidator,
StartupFolderValidator startupFolderValidator, StartupFolderValidator startupFolderValidator,
SystemFolderValidator systemFolderValidator, SystemFolderValidator systemFolderValidator,
@ -35,7 +34,6 @@ namespace NzbDrone.Api.RootFolders
.Cascade(CascadeMode.StopOnFirstFailure) .Cascade(CascadeMode.StopOnFirstFailure)
.IsValidPath() .IsValidPath()
.SetValidator(rootFolderValidator) .SetValidator(rootFolderValidator)
.SetValidator(droneFactoryValidator)
.SetValidator(mappedNetworkDriveValidator) .SetValidator(mappedNetworkDriveValidator)
.SetValidator(startupFolderValidator) .SetValidator(startupFolderValidator)
.SetValidator(pathExistsValidator) .SetValidator(pathExistsValidator)

View File

@ -48,7 +48,6 @@ namespace NzbDrone.Api.Series
RootFolderValidator rootFolderValidator, RootFolderValidator rootFolderValidator,
SeriesPathValidator seriesPathValidator, SeriesPathValidator seriesPathValidator,
SeriesExistsValidator seriesExistsValidator, SeriesExistsValidator seriesExistsValidator,
DroneFactoryValidator droneFactoryValidator,
SeriesAncestorValidator seriesAncestorValidator, SeriesAncestorValidator seriesAncestorValidator,
SystemFolderValidator systemFolderValidator, SystemFolderValidator systemFolderValidator,
ProfileExistsValidator profileExistsValidator, ProfileExistsValidator profileExistsValidator,
@ -78,7 +77,6 @@ namespace NzbDrone.Api.Series
.IsValidPath() .IsValidPath()
.SetValidator(rootFolderValidator) .SetValidator(rootFolderValidator)
.SetValidator(seriesPathValidator) .SetValidator(seriesPathValidator)
.SetValidator(droneFactoryValidator)
.SetValidator(seriesAncestorValidator) .SetValidator(seriesAncestorValidator)
.SetValidator(systemFolderValidator) .SetValidator(systemFolderValidator)
.When(s => !s.Path.IsNullOrWhiteSpace()); .When(s => !s.Path.IsNullOrWhiteSpace());

View File

@ -102,35 +102,6 @@ namespace NzbDrone.Core.Test.DiskSpace
.Verify(v => v.GetAvailableSpace(It.IsAny<string>()), Times.Never()); .Verify(v => v.GetAvailableSpace(It.IsAny<string>()), Times.Never());
} }
[Test]
public void should_check_diskspace_for_dronefactory_folder()
{
Mocker.GetMock<IConfigService>()
.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<IConfigService>()
.SetupGet(v => v.DownloadedEpisodesFolder)
.Returns(_droneFactoryFolder);
var freeSpace = Subject.GetFreeSpace();
freeSpace.Should().BeEmpty();
Mocker.GetMock<IDiskProvider>()
.Verify(v => v.GetAvailableSpace(It.IsAny<string>()), Times.Never());
}
[TestCase("/boot")] [TestCase("/boot")]
[TestCase("/var/lib/rancher")] [TestCase("/var/lib/rancher")]
[TestCase("/var/lib/rancher/volumes")] [TestCase("/var/lib/rancher/volumes")]

View File

@ -151,20 +151,6 @@ namespace NzbDrone.Core.Test.Download
AssertCompletedDownload(); AssertCompletedDownload();
} }
[Test]
public void should_not_process_if_storage_directory_in_drone_factory()
{
Mocker.GetMock<IConfigService>()
.SetupGet(v => v.DownloadedEpisodesFolder)
.Returns(@"C:\DropFolder".AsOsAgnostic());
_trackedDownload.DownloadItem.OutputPath = new OsPath(@"C:\DropFolder\SomeOtherFolder".AsOsAgnostic());
Subject.Process(_trackedDownload);
AssertNoAttemptedImport();
}
[Test] [Test]
public void should_not_process_if_output_path_is_empty() public void should_not_process_if_output_path_is_empty()
{ {

View File

@ -1,10 +1,9 @@
using System; using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Download.Clients.Pneumatic; using NzbDrone.Core.Download.Clients.Pneumatic;
using NzbDrone.Core.Parser.Model; 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 _nzbUrl = "http://www.nzbs.com/url";
private const string _title = "30.Rock.S01E05.hdtv.xvid-LoL"; private const string _title = "30.Rock.S01E05.hdtv.xvid-LoL";
private string _pneumaticFolder; private string _pneumaticFolder;
private string _sabDrop; private string _strmFolder;
private string _nzbPath; private string _nzbPath;
private RemoteEpisode _remoteEpisode; private RemoteEpisode _remoteEpisode;
@ -29,9 +28,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
_pneumaticFolder = @"d:\nzb\pneumatic\".AsOsAgnostic(); _pneumaticFolder = @"d:\nzb\pneumatic\".AsOsAgnostic();
_nzbPath = Path.Combine(_pneumaticFolder, _title + ".nzb").AsOsAgnostic(); _nzbPath = Path.Combine(_pneumaticFolder, _title + ".nzb").AsOsAgnostic();
_sabDrop = @"d:\unsorted tv\".AsOsAgnostic(); _strmFolder = @"d:\unsorted tv\".AsOsAgnostic();
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder).Returns(_sabDrop);
_remoteEpisode = new RemoteEpisode(); _remoteEpisode = new RemoteEpisode();
_remoteEpisode.Release = new ReleaseInfo(); _remoteEpisode.Release = new ReleaseInfo();
@ -44,7 +41,8 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
Subject.Definition = new DownloadClientDefinition(); Subject.Definition = new DownloadClientDefinition();
Subject.Definition.Settings = new PneumaticSettings Subject.Definition.Settings = new PneumaticSettings
{ {
NzbFolder = _pneumaticFolder NzbFolder = _pneumaticFolder,
StrmFolder = _strmFolder
}; };
} }
@ -61,7 +59,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once()); Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once());
} }
[Test] [Test]
public void should_throw_on_failed_download() public void should_throw_on_failed_download()
{ {

View File

@ -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<DroneFactoryCheck>
{
private const string DRONE_FACTORY_FOLDER = @"C:\Test\Unsorted";
private void GivenDroneFactoryFolder(bool exists = false, bool writable = true)
{
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.DownloadedEpisodesFolder)
.Returns(DRONE_FACTORY_FOLDER);
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.FolderExists(DRONE_FACTORY_FOLDER))
.Returns(exists);
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.FolderWritable(It.IsAny<string>()))
.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();
}
}
}

View File

@ -10,9 +10,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class ImportMechanismCheckFixture : CoreTest<ImportMechanismCheck> public class ImportMechanismCheckFixture : CoreTest<ImportMechanismCheck>
{ {
private const string DRONE_FACTORY_FOLDER = @"C:\Test\Unsorted";
private void GivenCompletedDownloadHandling(bool? enabled = null) private void GivenCompletedDownloadHandling(bool? enabled = null)
{ {
if (enabled.HasValue) if (enabled.HasValue)
@ -27,17 +24,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
} }
private void GivenDroneFactoryFolder(bool exists = false)
{
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.DownloadedEpisodesFolder)
.Returns(DRONE_FACTORY_FOLDER.AsOsAgnostic());
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.FolderExists(DRONE_FACTORY_FOLDER.AsOsAgnostic()))
.Returns(exists);
}
[Test] [Test]
public void should_return_warning_when_completed_download_handling_not_configured() 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() public void should_return_ok_when_no_issues_found()
{ {
GivenCompletedDownloadHandling(true); GivenCompletedDownloadHandling(true);
GivenDroneFactoryFolder(true);
Subject.Check().ShouldBeOk(); Subject.Check().ShouldBeOk();
} }

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
@ -20,7 +20,6 @@ namespace NzbDrone.Core.Test.MediaFiles
[TestFixture] [TestFixture]
public class DownloadedEpisodesCommandServiceFixture : CoreTest<DownloadedEpisodesCommandService> public class DownloadedEpisodesCommandServiceFixture : CoreTest<DownloadedEpisodesCommandService>
{ {
private string _droneFactory = "c:\\drop\\".AsOsAgnostic();
private string _downloadFolder = "c:\\drop_other\\Show.S01E01\\".AsOsAgnostic(); private string _downloadFolder = "c:\\drop_other\\Show.S01E01\\".AsOsAgnostic();
private string _downloadFile = "c:\\drop_other\\Show.S01E01.mkv".AsOsAgnostic(); private string _downloadFile = "c:\\drop_other\\Show.S01E01.mkv".AsOsAgnostic();
@ -29,9 +28,6 @@ namespace NzbDrone.Core.Test.MediaFiles
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder)
.Returns(_droneFactory);
Mocker.GetMock<IDownloadedEpisodesImportService>() Mocker.GetMock<IDownloadedEpisodesImportService>()
.Setup(v => v.ProcessRootFolder(It.IsAny<DirectoryInfo>())) .Setup(v => v.ProcessRootFolder(It.IsAny<DirectoryInfo>()))
.Returns(new List<ImportResult>()); .Returns(new List<ImportResult>());
@ -76,34 +72,12 @@ namespace NzbDrone.Core.Test.MediaFiles
.Returns(_trackedDownload); .Returns(_trackedDownload);
} }
[Test]
public void should_process_dronefactory_if_path_is_not_specified()
{
GivenExistingFolder(_droneFactory);
Subject.Execute(new DownloadedEpisodesScanCommand());
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Once());
}
[Test] [Test]
public void should_skip_import_if_dronefactory_doesnt_exist() public void should_skip_import_if_dronefactory_doesnt_exist()
{ {
Subject.Execute(new DownloadedEpisodesScanCommand()); Assert.Throws<ArgumentException>(() => Subject.Execute(new DownloadedEpisodesScanCommand()));
Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Never()); Mocker.GetMock<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), 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<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Once());
} }
[Test] [Test]

View File

@ -239,7 +239,6 @@
<Compile Include="HealthCheck\Checks\DeleteBadMediaCovers.cs" /> <Compile Include="HealthCheck\Checks\DeleteBadMediaCovers.cs" />
<Compile Include="HealthCheck\Checks\AppDataLocationFixture.cs" /> <Compile Include="HealthCheck\Checks\AppDataLocationFixture.cs" />
<Compile Include="HealthCheck\Checks\DownloadClientCheckFixture.cs" /> <Compile Include="HealthCheck\Checks\DownloadClientCheckFixture.cs" />
<Compile Include="HealthCheck\Checks\DroneFactoryCheckFixture.cs" />
<Compile Include="HealthCheck\Checks\HealthCheckFixtureExtensions.cs" /> <Compile Include="HealthCheck\Checks\HealthCheckFixtureExtensions.cs" />
<Compile Include="HealthCheck\Checks\ImportMechanismCheckFixture.cs" /> <Compile Include="HealthCheck\Checks\ImportMechanismCheckFixture.cs" />
<Compile Include="HealthCheck\Checks\IndexerSearchCheckFixture.cs" /> <Compile Include="HealthCheck\Checks\IndexerSearchCheckFixture.cs" />

View File

@ -96,18 +96,6 @@ namespace NzbDrone.Core.Test.RootFolderTests
Assert.Throws<UnauthorizedAccessException>(() => Subject.Add(new RootFolder { Path = @"C:\TV".AsOsAgnostic() })); Assert.Throws<UnauthorizedAccessException>(() => 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<IConfigService>()
.SetupGet(s => s.DownloadedEpisodesFolder)
.Returns(path);
Assert.Throws<InvalidOperationException>(() => Subject.Add(new RootFolder { Path = path }));
}
[TestCase("$recycle.bin")] [TestCase("$recycle.bin")]
[TestCase("system volume information")] [TestCase("system volume information")]
[TestCase("recycler")] [TestCase("recycler")]

View File

@ -74,13 +74,6 @@ namespace NzbDrone.Core.Configuration
return _repository.Get(key.ToLower()) != null; return _repository.Get(key.ToLower()) != null;
} }
public string DownloadedEpisodesFolder
{
get { return GetValue(ConfigKey.DownloadedEpisodesFolder.ToString()); }
set { SetValue(ConfigKey.DownloadedEpisodesFolder.ToString(), value); }
}
public bool AutoUnmonitorPreviouslyDownloadedEpisodes public bool AutoUnmonitorPreviouslyDownloadedEpisodes
{ {
get { return GetValueBoolean("AutoUnmonitorPreviouslyDownloadedEpisodes"); } get { return GetValueBoolean("AutoUnmonitorPreviouslyDownloadedEpisodes"); }
@ -181,13 +174,6 @@ namespace NzbDrone.Core.Configuration
set { SetValue("DownloadClientWorkingFolders", value); } set { SetValue("DownloadClientWorkingFolders", value); }
} }
public int DownloadedEpisodesScanInterval
{
get { return GetValueInt("DownloadedEpisodesScanInterval", 1); }
set { SetValue("DownloadedEpisodesScanInterval", value); }
}
public int DownloadClientHistoryLimit public int DownloadClientHistoryLimit
{ {
get { return GetValueInt("DownloadClientHistoryLimit", 30); } get { return GetValueInt("DownloadClientHistoryLimit", 30); }

View File

@ -11,9 +11,7 @@ namespace NzbDrone.Core.Configuration
bool IsDefined(string key); bool IsDefined(string key);
//Download Client //Download Client
string DownloadedEpisodesFolder { get; set; }
string DownloadClientWorkingFolders { get; set; } string DownloadClientWorkingFolders { get; set; }
int DownloadedEpisodesScanInterval { get; set; }
int DownloadClientHistoryLimit { get; set; } int DownloadClientHistoryLimit { get; set; }
//Completed/Failed Download Handling (Download client) //Completed/Failed Download Handling (Download client)

View File

@ -48,14 +48,6 @@ namespace NzbDrone.Core.DiskSpace
.Distinct(); .Distinct();
} }
private IEnumerable<string> GetDroneFactoryRootPaths()
{
if (_configService.DownloadedEpisodesFolder.IsNotNullOrWhiteSpace() && _diskProvider.FolderExists(_configService.DownloadedEpisodesFolder))
{
yield return _configService.DownloadedEpisodesFolder;
}
}
private IEnumerable<string> GetFixedDisksRootPaths() private IEnumerable<string> GetFixedDisksRootPaths()
{ {
return _diskProvider.GetMounts() return _diskProvider.GetMounts()

View File

@ -121,25 +121,13 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic
private string WriteStrmFile(string title, string nzbFile) private string WriteStrmFile(string title, string nzbFile)
{ {
string folder;
if (Settings.StrmFolder.IsNullOrWhiteSpace()) if (Settings.StrmFolder.IsNullOrWhiteSpace())
{ {
folder = _configService.DownloadedEpisodesFolder; throw new DownloadClientException("Strm Folder needs to be set for Pneumatic Downloader");
if (folder.IsNullOrWhiteSpace())
{
throw new DownloadClientException("Strm Folder needs to be set for Pneumatic Downloader");
}
}
else
{
folder = Settings.StrmFolder;
} }
var contents = string.Format("plugin://plugin.program.pneumatic/?mode=strm&type=add_file&nzb={0}&nzbname={1}", nzbFile, title); 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); _diskProvider.WriteAllText(filename, contents);

View File

@ -15,13 +15,11 @@ namespace NzbDrone.Core.Download.Clients.rTorrent
{ {
public RTorrentDirectoryValidator(RootFolderValidator rootFolderValidator, public RTorrentDirectoryValidator(RootFolderValidator rootFolderValidator,
PathExistsValidator pathExistsValidator, PathExistsValidator pathExistsValidator,
DroneFactoryValidator droneFactoryValidator,
MappedNetworkDriveValidator mappedNetworkDriveValidator) MappedNetworkDriveValidator mappedNetworkDriveValidator)
{ {
RuleFor(c => c.TvDirectory).Cascade(CascadeMode.StopOnFirstFailure) RuleFor(c => c.TvDirectory).Cascade(CascadeMode.StopOnFirstFailure)
.IsValidPath() .IsValidPath()
.SetValidator(rootFolderValidator) .SetValidator(rootFolderValidator)
.SetValidator(droneFactoryValidator)
.SetValidator(mappedNetworkDriveValidator) .SetValidator(mappedNetworkDriveValidator)
.SetValidator(pathExistsValidator) .SetValidator(pathExistsValidator)
.When(c => c.TvDirectory.IsNotNullOrWhiteSpace()) .When(c => c.TvDirectory.IsNotNullOrWhiteSpace())

View File

@ -13,8 +13,10 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
[JsonProperty(PropertyName = "torrentp")] [JsonProperty(PropertyName = "torrentp")]
public List<UTorrentTorrent> TorrentsChanged { get; set; } public List<UTorrentTorrent> TorrentsChanged { get; set; }
[JsonProperty(PropertyName = "torrentm")] [JsonProperty(PropertyName = "torrentm")]
public List<string> TorrentsRemoved { get; set; } public List<string> TorrentsRemoved { get; set; }
[JsonProperty(PropertyName = "torrentc")] [JsonProperty(PropertyName = "torrentc")]
public string CacheNumber { get; set; } public string CacheNumber { get; set; }

View File

@ -80,14 +80,6 @@ namespace NzbDrone.Core.Download
return; 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); var series = _parsingService.GetSeries(trackedDownload.DownloadItem.Title);
if (series == null) if (series == null)

View File

@ -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");
}
}
}

View File

@ -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());
}
}
}

View File

@ -1,11 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Common.Disk;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Configuration.Events;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Download.Clients.Nzbget; using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Download.Clients.Sabnzbd; using NzbDrone.Core.Download.Clients.Sabnzbd;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
@ -29,7 +27,6 @@ namespace NzbDrone.Core.HealthCheck.Checks
public override HealthCheck Check() public override HealthCheck Check()
{ {
var droneFactoryFolder = new OsPath(_configService.DownloadedEpisodesFolder);
List<ImportMechanismCheckStatus> downloadClients; List<ImportMechanismCheckStatus> downloadClients;
try try
@ -47,9 +44,6 @@ namespace NzbDrone.Core.HealthCheck.Checks
} }
var downloadClientIsLocalHost = downloadClients.All(v => v.Status.IsLocalhost); 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")) if (!_configService.IsDefined("EnableCompletedDownloadHandling"))
{ {
@ -61,32 +55,20 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (downloadClients.All(v => v.DownloadClient is Sabnzbd)) 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"); 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)) 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 (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"); 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()); return new HealthCheck(GetType());

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
@ -11,7 +11,6 @@ using NzbDrone.Core.HealthCheck;
using NzbDrone.Core.Housekeeping; using NzbDrone.Core.Housekeeping;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Lifecycle;
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;
using NzbDrone.Core.Tv.Commands; using NzbDrone.Core.Tv.Commands;
@ -74,13 +73,7 @@ namespace NzbDrone.Core.Jobs
{ {
Interval = GetRssSyncInterval(), Interval = GetRssSyncInterval(),
TypeName = typeof(RssSyncCommand).FullName TypeName = typeof(RssSyncCommand).FullName
}, }
new ScheduledTask
{
Interval = _configService.DownloadedEpisodesScanInterval,
TypeName = typeof(DownloadedEpisodesScanCommand).FullName
},
}; };
var currentTasks = _scheduledTaskRepository.All().ToList(); var currentTasks = _scheduledTaskRepository.All().ToList();
@ -144,10 +137,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 downloadedEpisodes = _scheduledTaskRepository.GetDefinition(typeof(DownloadedEpisodesScanCommand)); _scheduledTaskRepository.Update(rss);
downloadedEpisodes.Interval = _configService.DownloadedEpisodesScanInterval;
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, downloadedEpisodes });
} }
} }
} }

View File

@ -1,10 +1,10 @@
using System.Collections.Generic; using System;
using System.IO; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration; using NzbDrone.Common.Instrumentation.Extensions;
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.MediaFiles.EpisodeImport;
@ -17,41 +17,19 @@ namespace NzbDrone.Core.MediaFiles
private readonly IDownloadedEpisodesImportService _downloadedEpisodesImportService; private readonly IDownloadedEpisodesImportService _downloadedEpisodesImportService;
private readonly ITrackedDownloadService _trackedDownloadService; private readonly ITrackedDownloadService _trackedDownloadService;
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
private readonly IConfigService _configService;
private readonly Logger _logger; private readonly Logger _logger;
public DownloadedEpisodesCommandService(IDownloadedEpisodesImportService downloadedEpisodesImportService, public DownloadedEpisodesCommandService(IDownloadedEpisodesImportService downloadedEpisodesImportService,
ITrackedDownloadService trackedDownloadService, ITrackedDownloadService trackedDownloadService,
IDiskProvider diskProvider, IDiskProvider diskProvider,
IConfigService configService,
Logger logger) Logger logger)
{ {
_downloadedEpisodesImportService = downloadedEpisodesImportService; _downloadedEpisodesImportService = downloadedEpisodesImportService;
_trackedDownloadService = trackedDownloadService; _trackedDownloadService = trackedDownloadService;
_diskProvider = diskProvider; _diskProvider = diskProvider;
_configService = configService;
_logger = logger; _logger = logger;
} }
private List<ImportResult> ProcessDroneFactoryFolder()
{
var downloadedEpisodesFolder = _configService.DownloadedEpisodesFolder;
if (string.IsNullOrEmpty(downloadedEpisodesFolder))
{
_logger.Trace("Drone Factory folder is not configured");
return new List<ImportResult>();
}
if (!_diskProvider.FolderExists(downloadedEpisodesFolder))
{
_logger.Warn("Drone Factory folder [{0}] doesn't exist.", downloadedEpisodesFolder);
return new List<ImportResult>();
}
return _downloadedEpisodesImportService.ProcessRootFolder(new DirectoryInfo(downloadedEpisodesFolder));
}
private List<ImportResult> ProcessPath(DownloadedEpisodesScanCommand message) private List<ImportResult> ProcessPath(DownloadedEpisodesScanCommand message)
{ {
if (!_diskProvider.FolderExists(message.Path) && !_diskProvider.FileExists(message.Path)) if (!_diskProvider.FolderExists(message.Path) && !_diskProvider.FileExists(message.Path))
@ -91,14 +69,13 @@ namespace NzbDrone.Core.MediaFiles
} }
else else
{ {
importResults = ProcessDroneFactoryFolder(); throw new ArgumentException("A path must be provided", "path");
} }
if (importResults == null || importResults.All(v => v.Result != ImportResultType.Imported)) 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. // 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. _logger.ProgressDebug("Failed to import");
//message.SetMessage("Failed to import");
} }
} }
} }

View File

@ -600,11 +600,9 @@
<Compile Include="HealthCheck\Checks\AppDataLocationCheck.cs" /> <Compile Include="HealthCheck\Checks\AppDataLocationCheck.cs" />
<Compile Include="HealthCheck\Checks\DownloadClientCheck.cs" /> <Compile Include="HealthCheck\Checks\DownloadClientCheck.cs" />
<Compile Include="HealthCheck\Checks\DownloadClientStatusCheck.cs" /> <Compile Include="HealthCheck\Checks\DownloadClientStatusCheck.cs" />
<Compile Include="HealthCheck\Checks\DeprecatedDroneFactoryCheck.cs" />
<Compile Include="HealthCheck\Checks\MonoDebugCheck.cs" /> <Compile Include="HealthCheck\Checks\MonoDebugCheck.cs" />
<Compile Include="HealthCheck\Checks\MonoTlsCheck.cs" /> <Compile Include="HealthCheck\Checks\MonoTlsCheck.cs" />
<Compile Include="HealthCheck\Checks\MountCheck.cs" /> <Compile Include="HealthCheck\Checks\MountCheck.cs" />
<Compile Include="HealthCheck\Checks\DroneFactoryCheck.cs" />
<Compile Include="HealthCheck\Checks\ImportMechanismCheck.cs" /> <Compile Include="HealthCheck\Checks\ImportMechanismCheck.cs" />
<Compile Include="HealthCheck\Checks\IndexerRssCheck.cs" /> <Compile Include="HealthCheck\Checks\IndexerRssCheck.cs" />
<Compile Include="HealthCheck\Checks\IndexerStatusCheck.cs" /> <Compile Include="HealthCheck\Checks\IndexerStatusCheck.cs" />
@ -1250,7 +1248,6 @@
<Compile Include="Validation\NzbDroneValidationState.cs" /> <Compile Include="Validation\NzbDroneValidationState.cs" />
<Compile Include="Validation\Paths\SystemFolderValidator.cs" /> <Compile Include="Validation\Paths\SystemFolderValidator.cs" />
<Compile Include="Validation\Paths\MappedNetworkDriveValidator.cs" /> <Compile Include="Validation\Paths\MappedNetworkDriveValidator.cs" />
<Compile Include="Validation\Paths\DroneFactoryValidator.cs" />
<Compile Include="Validation\Paths\FolderWritableValidator.cs" /> <Compile Include="Validation\Paths\FolderWritableValidator.cs" />
<Compile Include="Validation\Paths\PathExistsValidator.cs" /> <Compile Include="Validation\Paths\PathExistsValidator.cs" />
<Compile Include="Validation\Paths\PathValidator.cs" /> <Compile Include="Validation\Paths\PathValidator.cs" />

View File

@ -104,11 +104,6 @@ namespace NzbDrone.Core.RootFolders
throw new InvalidOperationException("Recent directory already exists."); 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)) if (!_diskProvider.FolderWritable(rootFolder.Path))
{ {
throw new UnauthorizedAccessException(string.Format("Root folder path '{0}' is not writable by user '{1}'", rootFolder.Path, Environment.UserName)); throw new UnauthorizedAccessException(string.Format("Root folder path '{0}' is not writable by user '{1}'", rootFolder.Path, Environment.UserName));

View File

@ -13,7 +13,6 @@ namespace NzbDrone.Core.Tv
{ {
public AddSeriesValidator(RootFolderValidator rootFolderValidator, public AddSeriesValidator(RootFolderValidator rootFolderValidator,
SeriesPathValidator seriesPathValidator, SeriesPathValidator seriesPathValidator,
DroneFactoryValidator droneFactoryValidator,
SeriesAncestorValidator seriesAncestorValidator, SeriesAncestorValidator seriesAncestorValidator,
SeriesTitleSlugValidator seriesTitleSlugValidator) SeriesTitleSlugValidator seriesTitleSlugValidator)
{ {
@ -21,7 +20,6 @@ namespace NzbDrone.Core.Tv
.IsValidPath() .IsValidPath()
.SetValidator(rootFolderValidator) .SetValidator(rootFolderValidator)
.SetValidator(seriesPathValidator) .SetValidator(seriesPathValidator)
.SetValidator(droneFactoryValidator)
.SetValidator(seriesAncestorValidator); .SetValidator(seriesAncestorValidator);
RuleFor(c => c.TitleSlug).SetValidator(seriesTitleSlugValidator); RuleFor(c => c.TitleSlug).SetValidator(seriesTitleSlugValidator);

View File

@ -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());
}
}
}

View File

@ -1,24 +1,12 @@
using FluentValidation; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Validation.Paths;
namespace Sonarr.Api.V3.Config namespace Sonarr.Api.V3.Config
{ {
public class DownloadClientConfigModule : SonarrConfigModule<DownloadClientConfigResource> public class DownloadClientConfigModule : SonarrConfigModule<DownloadClientConfigResource>
{ {
public DownloadClientConfigModule(IConfigService configService, public DownloadClientConfigModule(IConfigService configService)
RootFolderValidator rootFolderValidator,
PathExistsValidator pathExistsValidator,
MappedNetworkDriveValidator mappedNetworkDriveValidator)
: base(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) protected override DownloadClientConfigResource ToResource(IConfigService model)

View File

@ -5,9 +5,7 @@ namespace Sonarr.Api.V3.Config
{ {
public class DownloadClientConfigResource : RestResource public class DownloadClientConfigResource : RestResource
{ {
public string DownloadedEpisodesFolder { get; set; }
public string DownloadClientWorkingFolders { get; set; } public string DownloadClientWorkingFolders { get; set; }
public int DownloadedEpisodesScanInterval { get; set; }
public bool EnableCompletedDownloadHandling { get; set; } public bool EnableCompletedDownloadHandling { get; set; }
public bool RemoveCompletedDownloads { get; set; } public bool RemoveCompletedDownloads { get; set; }
@ -22,9 +20,7 @@ namespace Sonarr.Api.V3.Config
{ {
return new DownloadClientConfigResource return new DownloadClientConfigResource
{ {
DownloadedEpisodesFolder = model.DownloadedEpisodesFolder,
DownloadClientWorkingFolders = model.DownloadClientWorkingFolders, DownloadClientWorkingFolders = model.DownloadClientWorkingFolders,
DownloadedEpisodesScanInterval = model.DownloadedEpisodesScanInterval,
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling, EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
RemoveCompletedDownloads = model.RemoveCompletedDownloads, RemoveCompletedDownloads = model.RemoveCompletedDownloads,

View File

@ -52,7 +52,6 @@ namespace Sonarr.Api.V3.Series
MappedNetworkDriveValidator mappedNetworkDriveValidator, MappedNetworkDriveValidator mappedNetworkDriveValidator,
SeriesPathValidator seriesPathValidator, SeriesPathValidator seriesPathValidator,
SeriesExistsValidator seriesExistsValidator, SeriesExistsValidator seriesExistsValidator,
DroneFactoryValidator droneFactoryValidator,
SeriesAncestorValidator seriesAncestorValidator, SeriesAncestorValidator seriesAncestorValidator,
SystemFolderValidator systemFolderValidator, SystemFolderValidator systemFolderValidator,
ProfileExistsValidator profileExistsValidator, ProfileExistsValidator profileExistsValidator,
@ -83,7 +82,6 @@ namespace Sonarr.Api.V3.Series
.SetValidator(rootFolderValidator) .SetValidator(rootFolderValidator)
.SetValidator(mappedNetworkDriveValidator) .SetValidator(mappedNetworkDriveValidator)
.SetValidator(seriesPathValidator) .SetValidator(seriesPathValidator)
.SetValidator(droneFactoryValidator)
.SetValidator(seriesAncestorValidator) .SetValidator(seriesAncestorValidator)
.SetValidator(systemFolderValidator) .SetValidator(systemFolderValidator)
.When(s => !s.Path.IsNullOrWhiteSpace()); .When(s => !s.Path.IsNullOrWhiteSpace());