mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-23 02:05:27 +02:00
Fixed: Status check for completed directories in Deluge
This commit is contained in:
parent
de69d8ec7e
commit
33139d4b53
@ -312,11 +312,12 @@ public void GetItems_should_ignore_items_without_hash()
|
||||
[Test]
|
||||
public void should_return_status_with_outputdirs()
|
||||
{
|
||||
var configItems = new Dictionary<string, object>();
|
||||
|
||||
configItems.Add("download_location", @"C:\Downloads\Downloading\deluge".AsOsAgnostic());
|
||||
configItems.Add("move_completed_path", @"C:\Downloads\Finished\deluge".AsOsAgnostic());
|
||||
configItems.Add("move_completed", true);
|
||||
var configItems = new Dictionary<string, object>
|
||||
{
|
||||
{ "download_location", @"C:\Downloads\Downloading\deluge".AsOsAgnostic() },
|
||||
{ "move_completed_path", @"C:\Downloads\Finished\deluge".AsOsAgnostic() },
|
||||
{ "move_completed", true }
|
||||
};
|
||||
|
||||
Mocker.GetMock<IDelugeProxy>()
|
||||
.Setup(v => v.GetConfig(It.IsAny<DelugeSettings>()))
|
||||
@ -328,5 +329,18 @@ public void should_return_status_with_outputdirs()
|
||||
result.OutputRootFolders.Should().NotBeNull();
|
||||
result.OutputRootFolders.First().Should().Be(@"C:\Downloads\Finished\deluge".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_status_with_outputdirs_for_directories_in_settings()
|
||||
{
|
||||
Subject.Definition.Settings.As<DelugeSettings>().DownloadDirectory = @"D:\Downloads\Downloading\deluge".AsOsAgnostic();
|
||||
Subject.Definition.Settings.As<DelugeSettings>().CompletedDirectory = @"D:\Downloads\Finished\deluge".AsOsAgnostic();
|
||||
|
||||
var result = Subject.GetStatus();
|
||||
|
||||
result.IsLocalhost.Should().BeTrue();
|
||||
result.OutputRootFolders.Should().NotBeNull();
|
||||
result.OutputRootFolders.First().Should().Be(@"D:\Downloads\Finished\deluge".AsOsAgnostic());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -216,9 +216,18 @@ public override DownloadClientInfo GetStatus()
|
||||
{
|
||||
var config = _proxy.GetConfig(Settings);
|
||||
var label = _proxy.GetLabelOptions(Settings);
|
||||
|
||||
OsPath destDir;
|
||||
|
||||
if (label != null && label.ApplyMoveCompleted && label.MoveCompleted)
|
||||
if (Settings.CompletedDirectory.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
destDir = new OsPath(Settings.CompletedDirectory);
|
||||
}
|
||||
else if (Settings.DownloadDirectory.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
destDir = new OsPath(Settings.DownloadDirectory);
|
||||
}
|
||||
else if (label is { ApplyMoveCompleted: true, MoveCompleted: true })
|
||||
{
|
||||
// if label exists and a label completed path exists and is enabled use it instead of global
|
||||
destDir = new OsPath(label.MoveCompletedPath);
|
||||
@ -234,7 +243,7 @@ public override DownloadClientInfo GetStatus()
|
||||
|
||||
var status = new DownloadClientInfo
|
||||
{
|
||||
IsLocalhost = Settings.Host == "127.0.0.1" || Settings.Host == "localhost"
|
||||
IsLocalhost = Settings.Host is "127.0.0.1" or "localhost"
|
||||
};
|
||||
|
||||
if (!destDir.IsEmpty)
|
||||
|
Loading…
Reference in New Issue
Block a user