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

Closes #2006
This commit is contained in:
Mark McDowall 2019-04-27 10:20:42 -07:00
parent ca4b03f48a
commit 6036bc17c5
3 changed files with 24 additions and 2 deletions

View File

@ -406,6 +406,26 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
result.OutputPath.Should().Be(@"O:\mymount\Droned.S01E01.Pilot.1080p.WEB-DL-DRONE".AsOsAgnostic());
}
[Test]
public void should_use_dest_dir_if_final_dir_is_not_set()
{
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/tv2/Droned.S01E01.Pilot.1080p.WEB-DL-DRONE";
GivenQueue(null);
GivenHistory(_completed);
Subject.GetItems().First().OutputPath.Should().Be(_completed.FinalDir);
}
[TestCase("11.0", false)]
[TestCase("12.0", true)]
[TestCase("11.0-b30ef0134", false)]

View File

@ -117,13 +117,14 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
foreach (var item in history)
{
var droneParameter = item.Parameters.SingleOrDefault(p => p.Name == "drone");
var historyItem = new DownloadClientItem();
var itemDir = item.FinalDir ?? item.DestDir;
historyItem.DownloadClient = Definition.Name;
historyItem.DownloadId = droneParameter == null ? item.Id.ToString() : droneParameter.Value.ToString();
historyItem.Title = item.Name;
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.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;

View File

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