Rename Drone Factory Config Keys (#70)

* Rename Drone Factory Config Keys
pull/71/head
Qstick 7 years ago committed by GitHub
parent 19414912ad
commit 2c42fc19e5

@ -12,13 +12,13 @@ namespace NzbDrone.Api.Config
MappedNetworkDriveValidator mappedNetworkDriveValidator)
: base(configService)
{
SharedValidator.RuleFor(c => c.DownloadedEpisodesFolder)
SharedValidator.RuleFor(c => c.DownloadedAlbumsFolder)
.Cascade(CascadeMode.StopOnFirstFailure)
.IsValidPath()
.SetValidator(rootFolderValidator)
.SetValidator(mappedNetworkDriveValidator)
.SetValidator(pathExistsValidator)
.When(c => !string.IsNullOrWhiteSpace(c.DownloadedEpisodesFolder));
.When(c => !string.IsNullOrWhiteSpace(c.DownloadedAlbumsFolder));
}
protected override DownloadClientConfigResource ToResource(IConfigService model)

@ -1,13 +1,13 @@
using NzbDrone.Api.REST;
using NzbDrone.Api.REST;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Api.Config
{
public class DownloadClientConfigResource : RestResource
{
public string DownloadedEpisodesFolder { get; set; }
public string DownloadedAlbumsFolder { get; set; }
public string DownloadClientWorkingFolders { get; set; }
public int DownloadedEpisodesScanInterval { get; set; }
public int DownloadedAlbumsScanInterval { get; set; }
public bool EnableCompletedDownloadHandling { get; set; }
public bool RemoveCompletedDownloads { get; set; }
@ -22,9 +22,9 @@ namespace NzbDrone.Api.Config
{
return new DownloadClientConfigResource
{
DownloadedEpisodesFolder = model.DownloadedEpisodesFolder,
DownloadedAlbumsFolder = model.DownloadedAlbumsFolder,
DownloadClientWorkingFolders = model.DownloadClientWorkingFolders,
DownloadedEpisodesScanInterval = model.DownloadedEpisodesScanInterval,
DownloadedAlbumsScanInterval = model.DownloadedAlbumsScanInterval,
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
RemoveCompletedDownloads = model.RemoveCompletedDownloads,

@ -106,7 +106,7 @@ namespace NzbDrone.Core.Test.DiskSpace
public void should_check_diskspace_for_dronefactory_folder()
{
Mocker.GetMock<IConfigService>()
.SetupGet(v => v.DownloadedEpisodesFolder)
.SetupGet(v => v.DownloadedAlbumsFolder)
.Returns(_droneFactoryFolder);
GivenExistingFolder(_droneFactoryFolder);
@ -120,7 +120,7 @@ namespace NzbDrone.Core.Test.DiskSpace
public void should_not_check_diskspace_for_missing_dronefactory_folder()
{
Mocker.GetMock<IConfigService>()
.SetupGet(v => v.DownloadedEpisodesFolder)
.SetupGet(v => v.DownloadedAlbumsFolder)
.Returns(_droneFactoryFolder);
var freeSpace = Subject.GetFreeSpace();

@ -157,7 +157,7 @@ namespace NzbDrone.Core.Test.Download
public void should_not_process_if_storage_directory_in_drone_factory()
{
Mocker.GetMock<IConfigService>()
.SetupGet(v => v.DownloadedEpisodesFolder)
.SetupGet(v => v.DownloadedAlbumsFolder)
.Returns(@"C:\DropFolder".AsOsAgnostic());
_trackedDownload.DownloadItem.OutputPath = new OsPath(@"C:\DropFolder\SomeOtherFolder".AsOsAgnostic());

@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
_nzbPath = Path.Combine(_pneumaticFolder, _title + ".nzb").AsOsAgnostic();
_sabDrop = @"d:\unsorted tv\".AsOsAgnostic();
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder).Returns(_sabDrop);
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedAlbumsFolder).Returns(_sabDrop);
_remoteEpisode = new RemoteAlbum();
_remoteEpisode.Release = new ReleaseInfo();

@ -15,7 +15,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
private void GivenDroneFactoryFolder(bool exists = false, bool writable = true)
{
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.DownloadedEpisodesFolder)
.SetupGet(s => s.DownloadedAlbumsFolder)
.Returns(DRONE_FACTORY_FOLDER);
Mocker.GetMock<IDiskProvider>()

@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
private void GivenDroneFactoryFolder(bool exists = false)
{
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.DownloadedEpisodesFolder)
.SetupGet(s => s.DownloadedAlbumsFolder)
.Returns(DRONE_FACTORY_FOLDER.AsOsAgnostic());
Mocker.GetMock<IDiskProvider>()

@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.MediaFiles
[SetUp]
public void Setup()
{
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder)
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedAlbumsFolder)
.Returns(_droneFactory);
Mocker.GetMock<IDownloadedEpisodesImportService>()

@ -102,7 +102,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
var path = @"C:\TV".AsOsAgnostic();
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.DownloadedEpisodesFolder)
.SetupGet(s => s.DownloadedAlbumsFolder)
.Returns(path);
Assert.Throws<InvalidOperationException>(() => Subject.Add(new RootFolder { Path = path }));

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@ -14,7 +14,7 @@ namespace NzbDrone.Core.Configuration
{
public enum ConfigKey
{
DownloadedEpisodesFolder
DownloadedAlbumsFolder
}
public class ConfigService : IConfigService
@ -74,11 +74,11 @@ namespace NzbDrone.Core.Configuration
return _repository.Get(key.ToLower()) != null;
}
public string DownloadedEpisodesFolder
public string DownloadedAlbumsFolder
{
get { return GetValue(ConfigKey.DownloadedEpisodesFolder.ToString()); }
get { return GetValue(ConfigKey.DownloadedAlbumsFolder.ToString()); }
set { SetValue(ConfigKey.DownloadedEpisodesFolder.ToString(), value); }
set { SetValue(ConfigKey.DownloadedAlbumsFolder.ToString(), value); }
}
public bool AutoUnmonitorPreviouslyDownloadedTracks
@ -168,11 +168,11 @@ namespace NzbDrone.Core.Configuration
set { SetValue("DownloadClientWorkingFolders", value); }
}
public int DownloadedEpisodesScanInterval
public int DownloadedAlbumsScanInterval
{
get { return GetValueInt("DownloadedEpisodesScanInterval", 1); }
get { return GetValueInt("DownloadedAlbumsScanInterval", 1); }
set { SetValue("DownloadedEpisodesScanInterval", value); }
set { SetValue("DownloadedAlbumsScanInterval", value); }
}
public int DownloadClientHistoryLimit

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

@ -0,0 +1,20 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(115)]
public class change_drone_factory_variable_name : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Execute.Sql("DELETE FROM Config WHERE [Key] = 'downloadedepisodesfolder'");
Execute.Sql("DELETE FROM Config WHERE [Key] = 'downloadedepisodesscaninterval'");
}
}
}

@ -52,9 +52,9 @@ namespace NzbDrone.Core.DiskSpace
private IEnumerable<DiskSpace> GetDroneFactoryFreeSpace()
{
if (_configService.DownloadedEpisodesFolder.IsNotNullOrWhiteSpace() && _diskProvider.FolderExists(_configService.DownloadedEpisodesFolder))
if (_configService.DownloadedAlbumsFolder.IsNotNullOrWhiteSpace() && _diskProvider.FolderExists(_configService.DownloadedAlbumsFolder))
{
return GetDiskSpace(new[] { _diskProvider.GetPathRoot(_configService.DownloadedEpisodesFolder) });
return GetDiskSpace(new[] { _diskProvider.GetPathRoot(_configService.DownloadedAlbumsFolder) });
}
return new List<DiskSpace>();

@ -117,7 +117,7 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic
if (Settings.StrmFolder.IsNullOrWhiteSpace())
{
folder = _configService.DownloadedEpisodesFolder;
folder = _configService.DownloadedAlbumsFolder;
if (folder.IsNullOrWhiteSpace())
{

@ -81,7 +81,7 @@ namespace NzbDrone.Core.Download
return;
}
var downloadedEpisodesFolder = new OsPath(_configService.DownloadedEpisodesFolder);
var downloadedEpisodesFolder = new OsPath(_configService.DownloadedAlbumsFolder);
if (downloadedEpisodesFolder.Contains(downloadItemOutputPath))
{

@ -17,7 +17,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
public override HealthCheck Check()
{
var droneFactoryFolder = _configService.DownloadedEpisodesFolder;
var droneFactoryFolder = _configService.DownloadedAlbumsFolder;
if (droneFactoryFolder.IsNullOrWhiteSpace())
{

@ -24,7 +24,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
public override HealthCheck Check()
{
var droneFactoryFolder = new OsPath(_configService.DownloadedEpisodesFolder);
var droneFactoryFolder = new OsPath(_configService.DownloadedAlbumsFolder);
List<ImportMechanismCheckStatus> downloadClients;
try

@ -65,10 +65,8 @@ namespace NzbDrone.Core.Jobs
new ScheduledTask{ Interval = 1, TypeName = typeof(CheckForFinishedDownloadCommand).FullName},
new ScheduledTask{ Interval = 5, TypeName = typeof(MessagingCleanupCommand).FullName},
new ScheduledTask{ Interval = 6*60, TypeName = typeof(ApplicationUpdateCommand).FullName},
//new ScheduledTask{ Interval = 3*60, TypeName = typeof(UpdateSceneMappingCommand).FullName},
new ScheduledTask{ Interval = 6*60, TypeName = typeof(CheckHealthCommand).FullName},
new ScheduledTask{ Interval = 12*60, TypeName = typeof(RefreshArtistCommand).FullName},
//new ScheduledTask{ Interval = 12*60, TypeName = typeof(RefreshSeriesCommand).FullName}, // TODO: Remove
new ScheduledTask{ Interval = 24*60, TypeName = typeof(HousekeepingCommand).FullName},
new ScheduledTask{ Interval = 7*24*60, TypeName = typeof(BackupCommand).FullName},
@ -80,7 +78,7 @@ namespace NzbDrone.Core.Jobs
new ScheduledTask
{
Interval = _configService.DownloadedEpisodesScanInterval,
Interval = _configService.DownloadedAlbumsScanInterval,
TypeName = typeof(DownloadedEpisodesScanCommand).FullName
},
};
@ -146,10 +144,10 @@ namespace NzbDrone.Core.Jobs
var rss = _scheduledTaskRepository.GetDefinition(typeof(RssSyncCommand));
rss.Interval = _configService.RssSyncInterval;
var downloadedEpisodes = _scheduledTaskRepository.GetDefinition(typeof(DownloadedEpisodesScanCommand));
downloadedEpisodes.Interval = _configService.DownloadedEpisodesScanInterval;
var downloadedAlbums = _scheduledTaskRepository.GetDefinition(typeof(DownloadedEpisodesScanCommand));
downloadedAlbums.Interval = _configService.DownloadedAlbumsScanInterval;
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, downloadedEpisodes });
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, downloadedAlbums });
}
}
}

@ -36,21 +36,21 @@ namespace NzbDrone.Core.MediaFiles
private List<ImportResult> ProcessDroneFactoryFolder()
{
var downloadedEpisodesFolder = _configService.DownloadedEpisodesFolder;
var downloadedAlbumsFolder = _configService.DownloadedAlbumsFolder;
if (string.IsNullOrEmpty(downloadedEpisodesFolder))
if (string.IsNullOrEmpty(downloadedAlbumsFolder))
{
_logger.Trace("Drone Factory folder is not configured");
return new List<ImportResult>();
}
if (!_diskProvider.FolderExists(downloadedEpisodesFolder))
if (!_diskProvider.FolderExists(downloadedAlbumsFolder))
{
_logger.Warn("Drone Factory folder [{0}] doesn't exist.", downloadedEpisodesFolder);
_logger.Warn("Drone Factory folder [{0}] doesn't exist.", downloadedAlbumsFolder);
return new List<ImportResult>();
}
return _downloadedEpisodesImportService.ProcessRootFolder(new DirectoryInfo(downloadedEpisodesFolder));
return _downloadedEpisodesImportService.ProcessRootFolder(new DirectoryInfo(downloadedAlbumsFolder));
}
private List<ImportResult> ProcessPath(DownloadedEpisodesScanCommand message)

@ -295,6 +295,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Datastore\Migration\105_rename_torrent_downloadstation.cs" />
<Compile Include="Datastore\Migration\115_change_drone_factory_variable_name.cs" />
<Compile Include="Datastore\Migration\114_remove_tv_naming.cs" />
<Compile Include="Datastore\Migration\113_music_blacklist.cs" />
<Compile Include="Datastore\Migration\112_music_history.cs" />

@ -107,7 +107,7 @@ namespace NzbDrone.Core.RootFolders
throw new InvalidOperationException("Recent directory already exists.");
}
if (_configService.DownloadedEpisodesFolder.IsNotNullOrWhiteSpace() && _configService.DownloadedEpisodesFolder.PathEquals(rootFolder.Path))
if (_configService.DownloadedAlbumsFolder.IsNotNullOrWhiteSpace() && _configService.DownloadedAlbumsFolder.PathEquals(rootFolder.Path))
{
throw new InvalidOperationException("Drone Factory folder cannot be used.");
}

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Validation.Paths
{
if (context.PropertyValue == null) return false;
var droneFactory = _configService.DownloadedEpisodesFolder;
var droneFactory = _configService.DownloadedAlbumsFolder;
if (string.IsNullOrWhiteSpace(droneFactory)) return true;

@ -5,12 +5,12 @@
<div class="col-sm-1 col-sm-push-8 help-inline">
<i class="icon-lidarr-form-info" title="Optional folder to periodically scan for possible imports"/>
<i class="icon-lidarr-form-warning" title="Do not use the folder that contains some or all of your sorted and named TV shows - doing so could cause data loss"></i>
<i class="icon-lidarr-form-warning" title="Do not use the folder that contains some or all of your sorted and named Music Artists - doing so could cause data loss"></i>
<i class="icon-lidarr-form-warning" title="Download client history items that are stored in the drone factory will be ignored."/>
</div>
<div class="col-sm-8 col-sm-pull-1">
<input type="text" name="downloadedEpisodesFolder" class="form-control x-path" />
<input type="text" name="downloadedAlbumsFolder" class="form-control x-path" />
</div>
</div>
@ -19,11 +19,11 @@
<div class="col-sm-1 col-sm-push-2 help-inline">
<i class="icon-lidarr-form-info" title="Interval in minutes to scan the Drone Factory. Set to zero to disable."/>
<i class="icon-lidarr-form-warning" title="Setting a high interval or disabling scanning will prevent episodes from being imported."></i>
<i class="icon-lidarr-form-warning" title="Setting a high interval or disabling scanning will prevent albums from being imported."></i>
</div>
<div class="col-sm-2 col-sm-pull-1">
<input type="number" name="downloadedEpisodesScanInterval" class="form-control" />
<input type="number" name="downloadedAlbumsScanInterval" class="form-control" />
</div>
</div>
</fieldset>
Loading…
Cancel
Save