aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-08-11 23:05:04 +0600
committerSergey M․ <dstftw@gmail.com>2015-08-11 23:05:04 +0600
commit9f3da138606773339de9accc2bc6522ea88185fe (patch)
treef38516c3a8c97f67be09378d96ef0f062c64c4a5
parentbf812ef71438036c23640f29bd7ae955289720ed (diff)
[downloader/external] Use generic _option
-rw-r--r--youtube_dl/downloader/external.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py
index 49d806ee4..6c310346c 100644
--- a/youtube_dl/downloader/external.py
+++ b/youtube_dl/downloader/external.py
@@ -45,12 +45,6 @@ class ExternalFD(FileDownloader):
def supports(cls, info_dict):
return info_dict['protocol'] in ('http', 'https', 'ftp', 'ftps')
- def _source_address(self, command_option):
- source_address = self.params.get('source_address')
- if source_address is None:
- return []
- return [command_option, source_address]
-
def _option(self, command_option, param):
param = self.params.get(param)
if param is None:
@@ -59,9 +53,6 @@ class ExternalFD(FileDownloader):
return [command_option]
return [command_option, param]
- def _no_check_certificate(self, command_option):
- return [command_option] if self.params.get('nocheckcertificate', False) else []
-
def _configuration_args(self, default=[]):
ex_args = self.params.get('external_downloader_args')
if ex_args is None:
@@ -88,7 +79,7 @@ class CurlFD(ExternalFD):
cmd = [self.exe, '--location', '-o', tmpfilename]
for key, val in info_dict['http_headers'].items():
cmd += ['--header', '%s: %s' % (key, val)]
- cmd += self._source_address('--interface')
+ cmd += self._option('--interface', 'source_address')
cmd += self._configuration_args()
cmd += ['--', info_dict['url']]
return cmd
@@ -109,9 +100,9 @@ class WgetFD(ExternalFD):
cmd = [self.exe, '-O', tmpfilename, '-nv', '--no-cookies']
for key, val in info_dict['http_headers'].items():
cmd += ['--header', '%s: %s' % (key, val)]
- cmd += self._source_address('--bind-address')
+ cmd += self._option('--bind-address', 'source_address')
cmd += self._option('--proxy', 'proxy')
- cmd += self._no_check_certificate('--no-check-certificate')
+ cmd += self._option('--no-check-certificate', 'nocheckcertificate')
cmd += self._configuration_args()
cmd += ['--', info_dict['url']]
return cmd
@@ -128,7 +119,7 @@ class Aria2cFD(ExternalFD):
cmd += ['--out', os.path.basename(tmpfilename)]
for key, val in info_dict['http_headers'].items():
cmd += ['--header', '%s: %s' % (key, val)]
- cmd += self._source_address('--interface')
+ cmd += self._option('--interface', 'source_address')
cmd += self._option('--all-proxy', 'proxy')
cmd += ['--', info_dict['url']]
return cmd