Removed Drone Factory
This commit is contained in:
parent
f31ac39e37
commit
cfb7494992
|
@ -6,19 +6,10 @@ namespace NzbDrone.Api.Config
|
|||
{
|
||||
public class DownloadClientConfigModule : NzbDroneConfigModule<DownloadClientConfigResource>
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -102,35 +102,6 @@ namespace NzbDrone.Core.Test.DiskSpace
|
|||
.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("/var/lib/rancher")]
|
||||
[TestCase("/var/lib/rancher/volumes")]
|
||||
|
|
|
@ -151,20 +151,6 @@ namespace NzbDrone.Core.Test.Download
|
|||
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]
|
||||
public void should_not_process_if_output_path_is_empty()
|
||||
{
|
||||
|
|
|
@ -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<IConfigService>().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<IHttpClient>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once());
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_throw_on_failed_download()
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,9 +10,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|||
[TestFixture]
|
||||
public class ImportMechanismCheckFixture : CoreTest<ImportMechanismCheck>
|
||||
{
|
||||
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<IConfigService>()
|
||||
.SetupGet(s => s.DownloadedEpisodesFolder)
|
||||
.Returns(DRONE_FACTORY_FOLDER.AsOsAgnostic());
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.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();
|
||||
}
|
||||
|
|
|
@ -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<DownloadedEpisodesCommandService>
|
||||
{
|
||||
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<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder)
|
||||
.Returns(_droneFactory);
|
||||
|
||||
Mocker.GetMock<IDownloadedEpisodesImportService>()
|
||||
.Setup(v => v.ProcessRootFolder(It.IsAny<DirectoryInfo>()))
|
||||
.Returns(new List<ImportResult>());
|
||||
|
@ -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<IDownloadedEpisodesImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<DirectoryInfo>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
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());
|
||||
|
||||
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]
|
||||
|
|
|
@ -239,7 +239,6 @@
|
|||
<Compile Include="HealthCheck\Checks\DeleteBadMediaCovers.cs" />
|
||||
<Compile Include="HealthCheck\Checks\AppDataLocationFixture.cs" />
|
||||
<Compile Include="HealthCheck\Checks\DownloadClientCheckFixture.cs" />
|
||||
<Compile Include="HealthCheck\Checks\DroneFactoryCheckFixture.cs" />
|
||||
<Compile Include="HealthCheck\Checks\HealthCheckFixtureExtensions.cs" />
|
||||
<Compile Include="HealthCheck\Checks\ImportMechanismCheckFixture.cs" />
|
||||
<Compile Include="HealthCheck\Checks\IndexerSearchCheckFixture.cs" />
|
||||
|
|
|
@ -96,18 +96,6 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
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("system volume information")]
|
||||
[TestCase("recycler")]
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -48,14 +48,6 @@ namespace NzbDrone.Core.DiskSpace
|
|||
.Distinct();
|
||||
}
|
||||
|
||||
private IEnumerable<string> GetDroneFactoryRootPaths()
|
||||
{
|
||||
if (_configService.DownloadedEpisodesFolder.IsNotNullOrWhiteSpace() && _diskProvider.FolderExists(_configService.DownloadedEpisodesFolder))
|
||||
{
|
||||
yield return _configService.DownloadedEpisodesFolder;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<string> GetFixedDisksRootPaths()
|
||||
{
|
||||
return _diskProvider.GetMounts()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -13,8 +13,10 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
|||
|
||||
[JsonProperty(PropertyName = "torrentp")]
|
||||
public List<UTorrentTorrent> TorrentsChanged { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "torrentm")]
|
||||
public List<string> TorrentsRemoved { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "torrentc")]
|
||||
public string CacheNumber { get; set; }
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<ImportMechanismCheckStatus> 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());
|
||||
|
|
|
@ -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<ScheduledTask> { rss, downloadedEpisodes });
|
||||
_scheduledTaskRepository.Update(rss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<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)
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -600,11 +600,9 @@
|
|||
<Compile Include="HealthCheck\Checks\AppDataLocationCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\DownloadClientCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\DownloadClientStatusCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\DeprecatedDroneFactoryCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\MonoDebugCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\MonoTlsCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\MountCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\DroneFactoryCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\ImportMechanismCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\IndexerRssCheck.cs" />
|
||||
<Compile Include="HealthCheck\Checks\IndexerStatusCheck.cs" />
|
||||
|
@ -1250,7 +1248,6 @@
|
|||
<Compile Include="Validation\NzbDroneValidationState.cs" />
|
||||
<Compile Include="Validation\Paths\SystemFolderValidator.cs" />
|
||||
<Compile Include="Validation\Paths\MappedNetworkDriveValidator.cs" />
|
||||
<Compile Include="Validation\Paths\DroneFactoryValidator.cs" />
|
||||
<Compile Include="Validation\Paths\FolderWritableValidator.cs" />
|
||||
<Compile Include="Validation\Paths\PathExistsValidator.cs" />
|
||||
<Compile Include="Validation\Paths\PathValidator.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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<DownloadClientConfigResource>
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue