diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs index feea1329d..525dc68f4 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs @@ -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)] diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs index c20548e57..507200c3b 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -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; diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetHistoryItem.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetHistoryItem.cs index b36885cf9..dc0b8a9ba 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetHistoryItem.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetHistoryItem.cs @@ -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 Parameters { get; set; } } }