Pneumatic wired up as download client

This commit is contained in:
Mark McDowall 2012-08-29 17:32:27 -07:00
parent 853f7689bc
commit 8b45714e59
2 changed files with 21 additions and 13 deletions

View File

@ -3,6 +3,7 @@
public enum DownloadClientType public enum DownloadClientType
{ {
Sabnzbd = 0, Sabnzbd = 0,
Blackhole = 1 Blackhole = 1,
Pneumatic = 2
} }
} }

View File

@ -18,6 +18,7 @@ namespace NzbDrone.Core.Providers
private readonly ConfigProvider _configProvider; private readonly ConfigProvider _configProvider;
private readonly BlackholeProvider _blackholeProvider; private readonly BlackholeProvider _blackholeProvider;
private readonly SignalRProvider _signalRProvider; private readonly SignalRProvider _signalRProvider;
private readonly PneumaticProvider _pneumaticProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private static readonly Logger logger = LogManager.GetCurrentClassLogger();
@ -25,7 +26,7 @@ namespace NzbDrone.Core.Providers
public DownloadProvider(SabProvider sabProvider, HistoryProvider historyProvider, public DownloadProvider(SabProvider sabProvider, HistoryProvider historyProvider,
EpisodeProvider episodeProvider, ExternalNotificationProvider externalNotificationProvider, EpisodeProvider episodeProvider, ExternalNotificationProvider externalNotificationProvider,
ConfigProvider configProvider, BlackholeProvider blackholeProvider, ConfigProvider configProvider, BlackholeProvider blackholeProvider,
SignalRProvider signalRProvider) SignalRProvider signalRProvider, PneumaticProvider pneumaticProvider)
{ {
_sabProvider = sabProvider; _sabProvider = sabProvider;
_historyProvider = historyProvider; _historyProvider = historyProvider;
@ -34,6 +35,7 @@ namespace NzbDrone.Core.Providers
_configProvider = configProvider; _configProvider = configProvider;
_blackholeProvider = blackholeProvider; _blackholeProvider = blackholeProvider;
_signalRProvider = signalRProvider; _signalRProvider = signalRProvider;
_pneumaticProvider = pneumaticProvider;
} }
public DownloadProvider() public DownloadProvider()
@ -54,16 +56,18 @@ namespace NzbDrone.Core.Providers
foreach (var episode in _episodeProvider.GetEpisodesByParseResult(parseResult)) foreach (var episode in _episodeProvider.GetEpisodesByParseResult(parseResult))
{ {
var history = new History(); var history = new History
history.Date = DateTime.Now; {
history.Indexer = parseResult.Indexer; Date = DateTime.Now,
history.IsProper = parseResult.Quality.Proper; Indexer = parseResult.Indexer,
history.Quality = parseResult.Quality.QualityType; IsProper = parseResult.Quality.Proper,
history.NzbTitle = parseResult.OriginalString; Quality = parseResult.Quality.QualityType,
history.EpisodeId = episode.EpisodeId; NzbTitle = parseResult.OriginalString,
history.SeriesId = episode.SeriesId; EpisodeId = episode.EpisodeId,
history.NzbInfoUrl = parseResult.NzbInfoUrl; SeriesId = episode.SeriesId,
history.ReleaseGroup = parseResult.ReleaseGroup; NzbInfoUrl = parseResult.NzbInfoUrl,
ReleaseGroup = parseResult.ReleaseGroup,
};
_historyProvider.Add(history); _historyProvider.Add(history);
_episodeProvider.MarkEpisodeAsFetched(episode.EpisodeId); _episodeProvider.MarkEpisodeAsFetched(episode.EpisodeId);
@ -77,13 +81,16 @@ namespace NzbDrone.Core.Providers
return success; return success;
} }
public virtual IDownloadClient GetActiveDownloadClient() public virtual IDownloadClient GetActiveDownloadClient()
{ {
switch (_configProvider.DownloadClient) switch (_configProvider.DownloadClient)
{ {
case DownloadClientType.Blackhole: case DownloadClientType.Blackhole:
return _blackholeProvider; return _blackholeProvider;
case DownloadClientType.Pneumatic:
return _pneumaticProvider;
default: default:
return _sabProvider; return _sabProvider;
} }