mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-22 22:14:44 -04:00
Download clients now use thingy provider
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using NzbDrone.Core.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
||||
@@ -12,42 +14,16 @@ namespace NzbDrone.Core.Download
|
||||
|
||||
public class DownloadClientProvider : IProvideDownloadClient
|
||||
{
|
||||
private readonly IDownloadClientFactory _downloadClientFactory;
|
||||
|
||||
private readonly SabnzbdClient _sabnzbdClient;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly BlackholeProvider _blackholeProvider;
|
||||
private readonly PneumaticClient _pneumaticClient;
|
||||
private readonly NzbgetClient _nzbgetClient;
|
||||
|
||||
|
||||
public DownloadClientProvider(SabnzbdClient sabnzbdClient, IConfigService configService,
|
||||
BlackholeProvider blackholeProvider,
|
||||
PneumaticClient pneumaticClient,
|
||||
NzbgetClient nzbgetClient)
|
||||
public DownloadClientProvider(IDownloadClientFactory downloadClientFactory)
|
||||
{
|
||||
_sabnzbdClient = sabnzbdClient;
|
||||
_configService = configService;
|
||||
_blackholeProvider = blackholeProvider;
|
||||
_pneumaticClient = pneumaticClient;
|
||||
_nzbgetClient = nzbgetClient;
|
||||
_downloadClientFactory = downloadClientFactory;
|
||||
}
|
||||
|
||||
public IDownloadClient GetDownloadClient()
|
||||
{
|
||||
switch (_configService.DownloadClient)
|
||||
{
|
||||
case DownloadClientType.Blackhole:
|
||||
return _blackholeProvider;
|
||||
|
||||
case DownloadClientType.Pneumatic:
|
||||
return _pneumaticClient;
|
||||
|
||||
case DownloadClientType.Nzbget:
|
||||
return _nzbgetClient;
|
||||
|
||||
default:
|
||||
return _sabnzbdClient;
|
||||
}
|
||||
return _downloadClientFactory.Enabled().FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user