aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/downloader/external.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-09-05 03:06:28 +0600
committerSergey M․ <dstftw@gmail.com>2015-09-05 03:06:28 +0600
commit1195a38f460a6bf895ada6405284da103dc467de (patch)
tree9b44ad76d809f024e80a4b6e68f47a747555fee7 /youtube_dl/downloader/external.py
parent66e289bab466079558b7acf5cea1057ae35c9bfa (diff)
downloadyoutube-dl-1195a38f460a6bf895ada6405284da103dc467de.tar.xz
[downloader/external] Use generalized cli option converters
Diffstat (limited to 'youtube_dl/downloader/external.py')
-rw-r--r--youtube_dl/downloader/external.py25
1 files changed, 8 insertions, 17 deletions
diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py
index 056215f8c..2bc011266 100644
--- a/youtube_dl/downloader/external.py
+++ b/youtube_dl/downloader/external.py
@@ -5,6 +5,10 @@ import subprocess
from .common import FileDownloader
from ..utils import (
+ cli_option,
+ cli_valueless_option,
+ cli_bool_option,
+ cli_configuration_args,
encodeFilename,
encodeArgument,
)
@@ -46,29 +50,16 @@ class ExternalFD(FileDownloader):
return info_dict['protocol'] in ('http', 'https', 'ftp', 'ftps')
def _option(self, command_option, param):
- param = self.params.get(param)
- if param is None:
- return []
- return [command_option, param]
+ return cli_option(self.params, 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]
+ return cli_bool_option(self.params, command_option, param, true_value, false_value, separator)
def _valueless_option(self, command_option, param, expected_value=True):
- param = self.params.get(param)
- return [command_option] if param == expected_value else []
+ return cli_valueless_option(self.params, command_option, param, expected_value)
def _configuration_args(self, default=[]):
- ex_args = self.params.get('external_downloader_args')
- if ex_args is None:
- return default
- assert isinstance(ex_args, list)
- return ex_args
+ return cli_configuration_args(self.params, 'external_downloader_args', default)
def _call_downloader(self, tmpfilename, info_dict):
""" Either overwrite this or implement _make_cmd """