aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/downloader
diff options
context:
space:
mode:
authorremitamine <remitamine@gmail.com>2015-09-04 20:57:19 +0100
committerremitamine <remitamine@gmail.com>2015-09-04 20:57:19 +0100
commitf30c2e8e9867373815aaaa2285f23524a67da730 (patch)
tree5e502c110b2459bee437cc29c6c10d11f71f5726 /youtube_dl/downloader
parent266b0ad6762eaa48156b021094126062cb9f44d6 (diff)
[downloader/external] add _argless_option for option without arguments
Diffstat (limited to 'youtube_dl/downloader')
-rw-r--r--youtube_dl/downloader/external.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py
index 22dfd2833..cae8f6f0f 100644
--- a/youtube_dl/downloader/external.py
+++ b/youtube_dl/downloader/external.py
@@ -49,8 +49,6 @@ class ExternalFD(FileDownloader):
param = self.params.get(param)
if param is None or param is False:
return []
- if isinstance(param, bool):
- return [command_option]
return [command_option, param]
def _bool_option(self, command_option, param, true_value='true', false_value='false', separator=None):
@@ -61,6 +59,10 @@ class ExternalFD(FileDownloader):
return [command_option + separator + (true_value if param else false_value)]
return [command_option, true_value if param else false_value]
+ def _argless_option(self, command_option, param, expected_value=True):
+ param = self.params.get(param)
+ return [command_option] if param == expected_value else []
+
def _configuration_args(self, default=[]):
ex_args = self.params.get('external_downloader_args')
if ex_args is None:
@@ -89,7 +91,7 @@ class CurlFD(ExternalFD):
cmd += ['--header', '%s: %s' % (key, val)]
cmd += self._option('--interface', 'source_address')
cmd += self._option('--proxy', 'proxy')
- cmd += self._option('--insecure', 'nocheckcertificate')
+ cmd += self._argless_option('--insecure', 'nocheckcertificate')
cmd += self._configuration_args()
cmd += ['--', info_dict['url']]
return cmd
@@ -112,7 +114,7 @@ class WgetFD(ExternalFD):
cmd += ['--header', '%s: %s' % (key, val)]
cmd += self._option('--bind-address', 'source_address')
cmd += self._option('--proxy', 'proxy')
- cmd += self._option('--no-check-certificate', 'nocheckcertificate')
+ cmd += self._argless_option('--no-check-certificate', 'nocheckcertificate')
cmd += self._configuration_args()
cmd += ['--', info_dict['url']]
return cmd