mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -07:00
Fixed: Don't treat NZBs rejected by SABnzbd as successful
This commit is contained in:
parent
499ec06664
commit
970d46512e
4 changed files with 35 additions and 4 deletions
|
@ -349,7 +349,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||||
{
|
{
|
||||||
Mocker.GetMock<ISabnzbdProxy>()
|
Mocker.GetMock<ISabnzbdProxy>()
|
||||||
.Setup(s => s.DownloadNzb(It.IsAny<byte[]>(), It.IsAny<string>(), It.IsAny<string>(), (int)SabnzbdPriority.High, It.IsAny<SabnzbdSettings>()))
|
.Setup(s => s.DownloadNzb(It.IsAny<byte[]>(), It.IsAny<string>(), It.IsAny<string>(), (int)SabnzbdPriority.High, It.IsAny<SabnzbdSettings>()))
|
||||||
.Returns(new SabnzbdAddResponse());
|
.Returns(new SabnzbdAddResponse { Ids = new List<string> { "lidarrtest" } });
|
||||||
|
|
||||||
var remoteAlbum = CreateRemoteAlbum();
|
var remoteAlbum = CreateRemoteAlbum();
|
||||||
remoteAlbum.Albums = Builder<Album>.CreateListOfSize(1)
|
remoteAlbum.Albums = Builder<Album>.CreateListOfSize(1)
|
||||||
|
|
|
@ -8,6 +8,7 @@ using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.Exceptions;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Validation;
|
using NzbDrone.Core.Validation;
|
||||||
using NzbDrone.Core.RemotePathMappings;
|
using NzbDrone.Core.RemotePathMappings;
|
||||||
|
@ -40,12 +41,13 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
|
|
||||||
var response = _proxy.DownloadNzb(fileContent, filename, category, priority, Settings);
|
var response = _proxy.DownloadNzb(fileContent, filename, category, priority, Settings);
|
||||||
|
|
||||||
if (response != null && response.Ids.Any())
|
if (response == null || response.Ids.Empty())
|
||||||
{
|
{
|
||||||
return response.Ids.First();
|
return response.Ids.First();
|
||||||
|
throw new DownloadClientRejectedReleaseException(remoteAlbum.Release, "SABnzbd rejected the NZB for an unknown reason");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return response.Ids.First();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<DownloadClientItem> GetQueue()
|
private IEnumerable<DownloadClientItem> GetQueue()
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Exceptions
|
||||||
|
{
|
||||||
|
public class DownloadClientRejectedReleaseException : ReleaseDownloadException
|
||||||
|
{
|
||||||
|
public DownloadClientRejectedReleaseException(ReleaseInfo release, string message, params object[] args)
|
||||||
|
: base(release, message, args)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public DownloadClientRejectedReleaseException(ReleaseInfo release, string message)
|
||||||
|
: base(release, message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public DownloadClientRejectedReleaseException(ReleaseInfo release, string message, Exception innerException, params object[] args)
|
||||||
|
: base(release, message, innerException, args)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public DownloadClientRejectedReleaseException(ReleaseInfo release, string message, Exception innerException)
|
||||||
|
: base(release, message, innerException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -455,6 +455,7 @@
|
||||||
<Compile Include="Exceptions\AlbumNotFoundException.cs" />
|
<Compile Include="Exceptions\AlbumNotFoundException.cs" />
|
||||||
<Compile Include="Exceptions\ArtistNotFoundException.cs" />
|
<Compile Include="Exceptions\ArtistNotFoundException.cs" />
|
||||||
<Compile Include="Exceptions\BadRequestException.cs" />
|
<Compile Include="Exceptions\BadRequestException.cs" />
|
||||||
|
<Compile Include="Exceptions\DownloadClientRejectedReleaseException.cs" />
|
||||||
<Compile Include="Exceptions\DownstreamException.cs" />
|
<Compile Include="Exceptions\DownstreamException.cs" />
|
||||||
<Compile Include="Exceptions\NzbDroneClientException.cs" />
|
<Compile Include="Exceptions\NzbDroneClientException.cs" />
|
||||||
<Compile Include="Exceptions\ReleaseUnavailableException.cs" />
|
<Compile Include="Exceptions\ReleaseUnavailableException.cs" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue