Ugly indexer release name cleaned up before sending to Sab.
This commit is contained in:
parent
06a2cb0de4
commit
fcc1439754
|
@ -231,6 +231,20 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||||
VerifyFailed(result);
|
VerifyFailed(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("[ TOWN ]-[ http://www.town.ag ]-[ ANIME ]-[Usenet Provider >> http://www.ssl- <<] - [Commie] Aldnoah Zero 18 [234C8FC7]", "[ TOWN ]-[ http-++www.town.ag ]-[ ANIME ]-[Usenet Provider http-++www.ssl- ] - [Commie] Aldnoah Zero 18 [234C8FC7].nzb")]
|
||||||
|
public void Download_should_use_clean_title(string title, string filename)
|
||||||
|
{
|
||||||
|
GivenSuccessfulDownload();
|
||||||
|
|
||||||
|
var remoteEpisode = CreateRemoteEpisode();
|
||||||
|
remoteEpisode.Release.Title = title;
|
||||||
|
|
||||||
|
var id = Subject.Download(remoteEpisode);
|
||||||
|
|
||||||
|
Mocker.GetMock<ISabnzbdProxy>()
|
||||||
|
.Verify(v => v.DownloadNzb(It.IsAny<byte[]>(), filename, It.IsAny<string>(), It.IsAny<int>(), It.IsAny<SabnzbdSettings>()), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Download_should_return_unique_id()
|
public void Download_should_return_unique_id()
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,11 +31,10 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
|
|
||||||
protected override string AddFromNzbFile(RemoteEpisode remoteEpisode, string filename, byte[] fileContent)
|
protected override string AddFromNzbFile(RemoteEpisode remoteEpisode, string filename, byte[] fileContent)
|
||||||
{
|
{
|
||||||
var title = remoteEpisode.Release.Title;
|
|
||||||
var category = Settings.TvCategory;
|
var category = Settings.TvCategory;
|
||||||
var priority = remoteEpisode.IsRecentEpisode() ? Settings.RecentTvPriority : Settings.OlderTvPriority;
|
var priority = remoteEpisode.IsRecentEpisode() ? Settings.RecentTvPriority : Settings.OlderTvPriority;
|
||||||
|
|
||||||
var response = _proxy.DownloadNzb(fileContent, title, category, priority, Settings);
|
var response = _proxy.DownloadNzb(fileContent, filename, category, priority, Settings);
|
||||||
|
|
||||||
if (response != null && response.Ids.Any())
|
if (response != null && response.Ids.Any())
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
{
|
{
|
||||||
public interface ISabnzbdProxy
|
public interface ISabnzbdProxy
|
||||||
{
|
{
|
||||||
SabnzbdAddResponse DownloadNzb(Byte[] nzbData, string name, string category, int priority, SabnzbdSettings settings);
|
SabnzbdAddResponse DownloadNzb(Byte[] nzbData, string filename, string category, int priority, SabnzbdSettings settings);
|
||||||
void RemoveFrom(string source, string id,bool deleteData, SabnzbdSettings settings);
|
void RemoveFrom(string source, string id,bool deleteData, SabnzbdSettings settings);
|
||||||
string ProcessRequest(IRestRequest restRequest, string action, SabnzbdSettings settings);
|
string ProcessRequest(IRestRequest restRequest, string action, SabnzbdSettings settings);
|
||||||
SabnzbdVersionResponse GetVersion(SabnzbdSettings settings);
|
SabnzbdVersionResponse GetVersion(SabnzbdSettings settings);
|
||||||
|
@ -30,12 +30,12 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SabnzbdAddResponse DownloadNzb(Byte[] nzbData, string title, string category, int priority, SabnzbdSettings settings)
|
public SabnzbdAddResponse DownloadNzb(Byte[] nzbData, string filename, string category, int priority, SabnzbdSettings settings)
|
||||||
{
|
{
|
||||||
var request = new RestRequest(Method.POST);
|
var request = new RestRequest(Method.POST);
|
||||||
var action = String.Format("mode=addfile&cat={0}&priority={1}", Uri.EscapeDataString(category), priority);
|
var action = String.Format("mode=addfile&cat={0}&priority={1}", Uri.EscapeDataString(category), priority);
|
||||||
|
|
||||||
request.AddFile("name", nzbData, title, "application/x-nzb");
|
request.AddFile("name", nzbData, filename, "application/x-nzb");
|
||||||
|
|
||||||
SabnzbdAddResponse response;
|
SabnzbdAddResponse response;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue