Radarr/NzbDrone.Core/Download/DownloadClientProvider.cs

54 lines
1.7 KiB
C#
Raw Normal View History

2013-04-01 06:22:16 +00:00
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Download.Clients.Sabnzbd;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Download
{
public interface IProvideDownloadClient
{
IDownloadClient GetDownloadClient();
}
public class DownloadClientProvider : IProvideDownloadClient
{
private readonly SabnzbdClient _sabnzbdClient;
2013-04-01 06:22:16 +00:00
private readonly IConfigService _configService;
private readonly BlackholeProvider _blackholeProvider;
private readonly PneumaticClient _pneumaticClient;
private readonly NzbgetClient _nzbgetClient;
2013-04-01 06:22:16 +00:00
public DownloadClientProvider(SabnzbdClient sabnzbdClient, IConfigService configService,
2013-04-01 06:22:16 +00:00
BlackholeProvider blackholeProvider,
PneumaticClient pneumaticClient,
NzbgetClient nzbgetClient)
2013-04-01 06:22:16 +00:00
{
_sabnzbdClient = sabnzbdClient;
2013-04-01 06:22:16 +00:00
_configService = configService;
_blackholeProvider = blackholeProvider;
_pneumaticClient = pneumaticClient;
_nzbgetClient = nzbgetClient;
2013-04-01 06:22:16 +00:00
}
public IDownloadClient GetDownloadClient()
{
switch (_configService.DownloadClient)
{
case DownloadClientType.Blackhole:
return _blackholeProvider;
case DownloadClientType.Pneumatic:
return _pneumaticClient;
2013-04-01 06:22:16 +00:00
case DownloadClientType.Nzbget:
return _nzbgetClient;
2013-04-01 06:22:16 +00:00
default:
return _sabnzbdClient;
2013-04-01 06:22:16 +00:00
}
}
}
}