mirror of
https://github.com/Radarr/Radarr
synced 2025-02-27 16:42:46 +00:00
Sabnzbdproxy now returns the folder instead of the file in case of a single file download.
This commit is contained in:
parent
341cb169eb
commit
9916479f02
2 changed files with 29 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
@ -12,7 +13,7 @@
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using System.Collections.Generic;
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||||
{
|
{
|
||||||
|
@ -254,5 +255,18 @@ public void Download_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
|
||||||
Mocker.GetMock<ISabnzbdProxy>()
|
Mocker.GetMock<ISabnzbdProxy>()
|
||||||
.Verify(v => v.DownloadNzb(It.IsAny<Stream>(), It.IsAny<String>(), It.IsAny<String>(), (int)SabnzbdPriority.High, It.IsAny<SabnzbdSettings>()), Times.Once());
|
.Verify(v => v.DownloadNzb(It.IsAny<Stream>(), It.IsAny<String>(), It.IsAny<String>(), (int)SabnzbdPriority.High, It.IsAny<SabnzbdSettings>()), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_return_path_to_folder_instead_of_file()
|
||||||
|
{
|
||||||
|
_completed.Items.First().Storage = @"C:\sorted\Droned.S01E01.Pilot.1080p.WEB-DL-DRONE\Droned.S01E01_Pilot_1080p_WEB-DL-DRONE.mkv".AsOsAgnostic();
|
||||||
|
|
||||||
|
WithQueue(null);
|
||||||
|
WithHistory(_completed);
|
||||||
|
|
||||||
|
var result = Subject.GetItems().Single();
|
||||||
|
|
||||||
|
result.OutputPath.Should().Be(@"C:\sorted\Droned.S01E01.Pilot.1080p.WEB-DL-DRONE".AsOsAgnostic());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
@ -142,7 +143,6 @@ private IEnumerable<DownloadClientItem> GetHistory()
|
||||||
DownloadTime = TimeSpan.FromSeconds(sabHistoryItem.DownloadTime),
|
DownloadTime = TimeSpan.FromSeconds(sabHistoryItem.DownloadTime),
|
||||||
RemainingTime = TimeSpan.Zero,
|
RemainingTime = TimeSpan.Zero,
|
||||||
|
|
||||||
OutputPath = sabHistoryItem.Storage,
|
|
||||||
Message = sabHistoryItem.FailMessage
|
Message = sabHistoryItem.FailMessage
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,6 +159,19 @@ private IEnumerable<DownloadClientItem> GetHistory()
|
||||||
historyItem.Status = DownloadItemStatus.Downloading;
|
historyItem.Status = DownloadItemStatus.Downloading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sabHistoryItem.Storage.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
var parent = Directory.GetParent(sabHistoryItem.Storage);
|
||||||
|
if (parent.Name == sabHistoryItem.Title)
|
||||||
|
{
|
||||||
|
historyItem.OutputPath = parent.FullName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
historyItem.OutputPath = sabHistoryItem.Storage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
historyItems.Add(historyItem);
|
historyItems.Add(historyItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue