1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

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 @@ public void should_remap_storage_if_mounted()
result.OutputPath.Should().Be(@"O:\mymount\Droned.S01E01.Pilot.1080p.WEB-DL-DRONE".AsOsAgnostic()); 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("11.0", false)]
[TestCase("12.0", true)] [TestCase("12.0", true)]
[TestCase("11.0-b30ef0134", false)] [TestCase("11.0-b30ef0134", false)]

View File

@ -117,13 +117,14 @@ private IEnumerable<DownloadClientItem> GetHistory()
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 ?? item.DestDir;
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;

View File

@ -16,6 +16,7 @@ public class NzbgetHistoryItem
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; }
} }
} }