skip queue check and adding new items if download client isn't configured correctly.

This commit is contained in:
kay.one
2013-07-30 22:49:41 -07:00
parent 1eb278c7f6
commit a5bb99367e
8 changed files with 73 additions and 5 deletions
@@ -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);
+8 -2
View File
@@ -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();
}