|
|
@ -2,6 +2,7 @@
|
|
|
|
using Ninject;
|
|
|
|
using Ninject;
|
|
|
|
using NLog;
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
|
@ -12,17 +13,22 @@ namespace NzbDrone.Core.Providers
|
|
|
|
private readonly HistoryProvider _historyProvider;
|
|
|
|
private readonly HistoryProvider _historyProvider;
|
|
|
|
private readonly EpisodeProvider _episodeProvider;
|
|
|
|
private readonly EpisodeProvider _episodeProvider;
|
|
|
|
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
|
|
|
private readonly ExternalNotificationProvider _externalNotificationProvider;
|
|
|
|
|
|
|
|
private readonly ConfigProvider _configProvider;
|
|
|
|
|
|
|
|
private readonly BlackholeProvider _blackholeProvider;
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
[Inject]
|
|
|
|
public DownloadProvider(SabProvider sabProvider, HistoryProvider historyProvider,
|
|
|
|
public DownloadProvider(SabProvider sabProvider, HistoryProvider historyProvider,
|
|
|
|
EpisodeProvider episodeProvider, ExternalNotificationProvider externalNotificationProvider)
|
|
|
|
EpisodeProvider episodeProvider, ExternalNotificationProvider externalNotificationProvider,
|
|
|
|
|
|
|
|
ConfigProvider configProvider, BlackholeProvider blackholeProvider)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_sabProvider = sabProvider;
|
|
|
|
_sabProvider = sabProvider;
|
|
|
|
_historyProvider = historyProvider;
|
|
|
|
_historyProvider = historyProvider;
|
|
|
|
_episodeProvider = episodeProvider;
|
|
|
|
_episodeProvider = episodeProvider;
|
|
|
|
_externalNotificationProvider = externalNotificationProvider;
|
|
|
|
_externalNotificationProvider = externalNotificationProvider;
|
|
|
|
|
|
|
|
_configProvider = configProvider;
|
|
|
|
|
|
|
|
_blackholeProvider = blackholeProvider;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DownloadProvider()
|
|
|
|
public DownloadProvider()
|
|
|
@ -31,14 +37,22 @@ namespace NzbDrone.Core.Providers
|
|
|
|
|
|
|
|
|
|
|
|
public virtual bool DownloadReport(EpisodeParseResult parseResult)
|
|
|
|
public virtual bool DownloadReport(EpisodeParseResult parseResult)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_sabProvider.IsInQueue(parseResult))
|
|
|
|
var sabTitle = _sabProvider.GetSabTitle(parseResult);
|
|
|
|
|
|
|
|
bool addSuccess = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_configProvider.DownloadClient == DownloadClientType.Blackhole)
|
|
|
|
|
|
|
|
addSuccess = _blackholeProvider.DownloadNzb(parseResult, sabTitle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_configProvider.DownloadClient == DownloadClientType.Sabnzbd)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(_sabProvider.IsInQueue(parseResult))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger.Warn("Episode {0} is already in sab's queue. skipping.", parseResult);
|
|
|
|
Logger.Warn("Episode {0} is already in sab's queue. skipping.", parseResult);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var sabTitle = _sabProvider.GetSabTitle(parseResult);
|
|
|
|
addSuccess = _sabProvider.AddByUrl(parseResult.NzbUrl, sabTitle);
|
|
|
|
var addSuccess = _sabProvider.AddByUrl(parseResult.NzbUrl, sabTitle);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (addSuccess)
|
|
|
|
if (addSuccess)
|
|
|
|
{
|
|
|
|
{
|
|
|
|