diff options
author | remitamine <remitamine@gmail.com> | 2015-09-04 20:07:36 +0100 |
---|---|---|
committer | remitamine <remitamine@gmail.com> | 2015-09-04 20:07:36 +0100 |
commit | 266b0ad6762eaa48156b021094126062cb9f44d6 (patch) | |
tree | 5dea70bb965647a85aab3cd67e3a179f69ac293c /youtube_dl | |
parent | e7a8c3032d8610bc429b6318678387433728b2a9 (diff) |
[downloader/external] add _bool_option to pass value to bool option
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/downloader/external.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py index 072ac3a46..22dfd2833 100644 --- a/youtube_dl/downloader/external.py +++ b/youtube_dl/downloader/external.py @@ -53,6 +53,14 @@ class ExternalFD(FileDownloader): 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 @@ class Aria2cFD(ExternalFD): 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 |