Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Radarr/commit/a5bb99367e6c31cbe3ae4e9abd39d2c97e79c8a4
You should set ROOT_URL correctly, otherwise the web may not work correctly.
8 changed files with
73 additions and
5 deletions
@ -6,6 +6,7 @@ using NzbDrone.Core.Download;
using NzbDrone.Core.Parser.Model ;
using NzbDrone.Core.Test.Framework ;
using NzbDrone.Core.Tv ;
using NzbDrone.Test.Common ;
namespace NzbDrone.Core.Test.Download
{
@ -28,9 +29,12 @@ namespace NzbDrone.Core.Test.Download
_parseResult = Builder < RemoteEpisode > . CreateNew ( )
. With ( c = > c . Series = Builder < Series > . CreateNew ( ) . Build ( ) )
. With ( c = > c . Report = Builder < ReportInfo > . CreateNew ( ) . Build ( ) )
. With ( c = > c . Report = Builder < ReportInfo > . CreateNew ( ) . Build ( ) )
. With ( c = > c . Episodes = episodes )
. Build ( ) ;
Mocker . GetMock < IDownloadClient > ( ) . Setup ( c = > c . IsConfigured ) . Returns ( true ) ;
}
private void WithSuccessfulAdd ( )
@ -76,5 +80,20 @@ namespace NzbDrone.Core.Test.Download
Subject . DownloadReport ( _parseResult ) ;
VerifyEventNotPublished < EpisodeGrabbedEvent > ( ) ;
}
[Test]
public void should_not_attempt_download_if_client_isnt_configure ( )
{
Mocker . GetMock < IDownloadClient > ( ) . Setup ( c = > c . IsConfigured ) . Returns ( false ) ;
Subject . DownloadReport ( _parseResult ) ;
Mocker . GetMock < IDownloadClient > ( ) . Verify ( c = > c . DownloadNzb ( It . IsAny < RemoteEpisode > ( ) ) , Times . Never ( ) ) ;
VerifyEventNotPublished < EpisodeGrabbedEvent > ( ) ;
ExceptionVerification . ExpectedWarns ( 1 ) ;
}
}
}
@ -1,6 +1,7 @@
using System ;
using System.Collections.Generic ;
using System.Linq ;
using NLog ;
using NzbDrone.Core.Download ;
using NzbDrone.Core.Parser.Model ;
using NzbDrone.Core.Tv ;
@ -10,10 +11,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public class NotInQueueSpecification : IDecisionEngineSpecification
{
private readonly IProvideDownloadClient _downloadClientProvider ;
private readonly Logger _logger ;
public NotInQueueSpecification ( IProvideDownloadClient downloadClientProvider )
public NotInQueueSpecification ( IProvideDownloadClient downloadClientProvider , Logger logger )
{
_downloadClientProvider = downloadClientProvider ;
_logger = logger ;
}
public string RejectionReason
@ -28,6 +31,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
var downloadClient = _downloadClientProvider . GetDownloadClient ( ) ;
if ( ! downloadClient . IsConfigured )
{
_logger . Warn ( "Download client {0} isn't configured yet." , downloadClient . GetType ( ) . Name ) ;
return true ;
}
var queue = downloadClient . GetQueue ( ) . Select ( queueItem = > Parser . Parser . ParseTitle ( queueItem . Title ) ) . Where ( episodeInfo = > episodeInfo ! = null ) ;
return ! IsInQueue ( subject , queue ) ;
@ -63,6 +63,14 @@ namespace NzbDrone.Core.Download.Clients
}
}
public bool IsConfigured
{
get
{
return ! string . IsNullOrWhiteSpace ( _configService . BlackholeFolder ) ;
}
}
public IEnumerable < QueueItem > GetQueue ( )
{
return new QueueItem [ 0 ] ;
@ -57,6 +57,14 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
return false ;
}
public bool IsConfigured
{
get
{
return ! string . IsNullOrWhiteSpace ( _configService . NzbgetHost ) & & _configService . NzbgetPort ! = 0 ;
}
}
public virtual IEnumerable < QueueItem > GetQueue ( )
{
var command = new JsonRequest
@ -68,6 +68,14 @@ namespace NzbDrone.Core.Download.Clients
}
}
public bool IsConfigured
{
get
{
return ! string . IsNullOrWhiteSpace ( _configService . PneumaticFolder ) ;
}
}
public IEnumerable < QueueItem > GetQueue ( )
{
return new QueueItem [ 0 ] ;
@ -24,7 +24,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
public IRestRequest AddToQueueRequest ( RemoteEpisode remoteEpisode )
{
string cat = _configService . SabTvCategory ;
int priority = ( int ) _configService . SabRecentTvPriority ;
int priority = ( int ) _configService . SabRecentTvPriority ;
string name = remoteEpisode . Report . NzbUrl . Replace ( "&" , "%26" ) ;
string nzbName = HttpUtility . UrlEncode ( remoteEpisode . Report . Title ) ;
@ -97,6 +97,15 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
return false ;
}
public bool IsConfigured
{
get
{
return ! string . IsNullOrWhiteSpace ( _configService . SabHost )
& & _configService . SabPort ! = 0 ;
}
}
public IEnumerable < QueueItem > GetQueue ( )
{
string action = String . Format ( "mode=queue&output=json&start={0}&limit={1}" , 0 , 0 ) ;
@ -27,9 +27,15 @@ namespace NzbDrone.Core.Download
public bool DownloadReport ( RemoteEpisode remoteEpisode )
{
var downloadTitle = remoteEpisode . Report . Title ;
var provider = _downloadClientProvider . GetDownloadClient ( ) ;
var downloadClient = _downloadClientProvider . GetDownloadClient ( ) ;
bool success = provider . DownloadNzb ( remoteEpisode ) ;
if ( ! downloadClient . IsConfigured )
{
_logger . Warn ( "Download client {0} isn't configured yet." , downloadClient . GetType ( ) . Name ) ;
return false ;
}
bool success = downloadClient . DownloadNzb ( remoteEpisode ) ;
if ( success )
{
@ -6,6 +6,7 @@ namespace NzbDrone.Core.Download
public interface IDownloadClient
{
bool DownloadNzb ( RemoteEpisode remoteEpisode ) ;
bool IsConfigured { get ; }
IEnumerable < QueueItem > GetQueue ( ) ;
}