New: Use NZBget's FinalDir if set by post-processing script

pull/6/head
Qstick 6 years ago
parent 970d46512e
commit e9dfdab907

@ -405,6 +405,37 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
result.OutputPath.Should().Be(@"O:\mymount\Fall Out Boy-Make America Psycho Again-CD-FLAC-2015-FORSAKEN".AsOsAgnostic()); result.OutputPath.Should().Be(@"O:\mymount\Fall Out Boy-Make America Psycho Again-CD-FLAC-2015-FORSAKEN".AsOsAgnostic());
} }
[Test]
public void should_use_dest_dir_if_final_dir_is_null()
{
GivenQueue(null);
GivenHistory(_completed);
Subject.GetItems().First().OutputPath.Should().Be(_completed.DestDir);
}
[Test]
public void should_use_dest_dir_if_final_dir_is_not_set()
{
_completed.FinalDir = string.Empty;
GivenQueue(null);
GivenHistory(_completed);
Subject.GetItems().First().OutputPath.Should().Be(_completed.DestDir);
}
[Test]
public void should_use_final_dir_when_set_instead_of_dest_dir()
{
_completed.FinalDir = "/remote/mount/music2/Some.Artist-Some.Album.FLAC.2018-DRONE";
GivenQueue(null);
GivenHistory(_completed);
Subject.GetItems().First().OutputPath.Should().Be(_completed.FinalDir);
}
[TestCase("11.0", false)] [TestCase("11.0", false)]
[TestCase("12.0", true)] [TestCase("12.0", true)]
[TestCase("11.0-b30ef0134", false)] [TestCase("11.0-b30ef0134", false)]

@ -117,13 +117,14 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
foreach (var item in history) foreach (var item in history)
{ {
var droneParameter = item.Parameters.SingleOrDefault(p => p.Name == "drone"); var droneParameter = item.Parameters.SingleOrDefault(p => p.Name == "drone");
var historyItem = new DownloadClientItem(); var historyItem = new DownloadClientItem();
var itemDir = item.FinalDir.IsNullOrWhiteSpace() ? item.DestDir : item.FinalDir;
historyItem.DownloadClient = Definition.Name; historyItem.DownloadClient = Definition.Name;
historyItem.DownloadId = droneParameter == null ? item.Id.ToString() : droneParameter.Value.ToString(); historyItem.DownloadId = droneParameter == null ? item.Id.ToString() : droneParameter.Value.ToString();
historyItem.Title = item.Name; historyItem.Title = item.Name;
historyItem.TotalSize = MakeInt64(item.FileSizeHi, item.FileSizeLo); historyItem.TotalSize = MakeInt64(item.FileSizeHi, item.FileSizeLo);
historyItem.OutputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(item.DestDir)); historyItem.OutputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(itemDir));
historyItem.Category = item.Category; historyItem.Category = item.Category;
historyItem.Message = $"PAR Status: {item.ParStatus} - Unpack Status: {item.UnpackStatus} - Move Status: {item.MoveStatus} - Script Status: {item.ScriptStatus} - Delete Status: {item.DeleteStatus} - Mark Status: {item.MarkStatus}"; historyItem.Message = $"PAR Status: {item.ParStatus} - Unpack Status: {item.UnpackStatus} - Move Status: {item.MoveStatus} - Script Status: {item.ScriptStatus} - Delete Status: {item.DeleteStatus} - Mark Status: {item.MarkStatus}";
historyItem.Status = DownloadItemStatus.Completed; historyItem.Status = DownloadItemStatus.Completed;

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace NzbDrone.Core.Download.Clients.Nzbget namespace NzbDrone.Core.Download.Clients.Nzbget
{ {
@ -16,6 +16,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
public string DeleteStatus { get; set; } public string DeleteStatus { get; set; }
public string MarkStatus { get; set; } public string MarkStatus { get; set; }
public string DestDir { get; set; } public string DestDir { get; set; }
public string FinalDir { get; set; }
public List<NzbgetParameter> Parameters { get; set; } public List<NzbgetParameter> Parameters { get; set; }
} }
} }

Loading…
Cancel
Save