0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-23 02:25:11 +00:00

[downloader/external] add _bool_option to pass value to bool option

This commit is contained in:
remitamine 2015-09-04 20:07:36 +01:00
parent e7a8c3032d
commit 266b0ad676

View file

@ -53,6 +53,14 @@ def _option(self, command_option, param):
return [command_option]
return [command_option, param]
def _bool_option(self, command_option, param, true_value='true', false_value='false', separator=None):
param = self.params.get(param)
if not isinstance(param, bool):
return []
if separator:
return [command_option + separator + (true_value if param else false_value)]
return [command_option, true_value if param else false_value]
def _configuration_args(self, default=[]):
ex_args = self.params.get('external_downloader_args')
if ex_args is None:
@ -123,7 +131,7 @@ def _make_cmd(self, tmpfilename, info_dict):
cmd += ['--header', '%s: %s' % (key, val)]
cmd += self._option('--interface', 'source_address')
cmd += self._option('--all-proxy', 'proxy')
cmd += self._option('--check-certificate=false', 'nocheckcertificate')
cmd += self._bool_option('--check-certificate', 'nocheckcertificate', 'false', 'true', '=')
cmd += ['--', info_dict['url']]
return cmd