You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/src/NzbDrone.Core/Download/DownloadClientProvider.cs

53 lines
1.7 KiB

12 years ago
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Download.Clients.Sabnzbd;
namespace NzbDrone.Core.Download
{
public interface IProvideDownloadClient
{
IDownloadClient GetDownloadClient();
}
public class DownloadClientProvider : IProvideDownloadClient
{
private readonly SabnzbdClient _sabnzbdClient;
12 years ago
private readonly IConfigService _configService;
private readonly BlackholeProvider _blackholeProvider;
private readonly PneumaticClient _pneumaticClient;
private readonly NzbgetClient _nzbgetClient;
12 years ago
public DownloadClientProvider(SabnzbdClient sabnzbdClient, IConfigService configService,
12 years ago
BlackholeProvider blackholeProvider,
PneumaticClient pneumaticClient,
NzbgetClient nzbgetClient)
12 years ago
{
_sabnzbdClient = sabnzbdClient;
12 years ago
_configService = configService;
_blackholeProvider = blackholeProvider;
_pneumaticClient = pneumaticClient;
_nzbgetClient = nzbgetClient;
12 years ago
}
public IDownloadClient GetDownloadClient()
{
switch (_configService.DownloadClient)
{
case DownloadClientType.Blackhole:
return _blackholeProvider;
case DownloadClientType.Pneumatic:
return _pneumaticClient;
12 years ago
case DownloadClientType.Nzbget:
return _nzbgetClient;
12 years ago
default:
return _sabnzbdClient;
12 years ago
}
}
}
}