Allow specifying path in `--external-downloader`

pull/95/head
pukkandan 4 years ago
parent 86878b6cd9
commit 7f7de7f94d

@ -326,9 +326,10 @@ Then simply run `make`. You can also run `make yt-dlp` instead to compile only t
--no-hls-use-mpegts Do not use the mpegts container for HLS --no-hls-use-mpegts Do not use the mpegts container for HLS
videos. This is default when not videos. This is default when not
downloading live streams downloading live streams
--external-downloader NAME Use the specified external downloader. --external-downloader NAME Name or path of the external downloader to
Currently supports aria2c, avconv, axel, use. Currently supports aria2c, avconv,
curl, ffmpeg, httpie, wget axel, curl, ffmpeg, httpie, wget
(Recommended: aria2c)
--downloader-args NAME:ARGS Give these arguments to the external --downloader-args NAME:ARGS Give these arguments to the external
downloader. Specify the downloader name and downloader. Specify the downloader name and
the arguments separated by a colon ":". You the arguments separated by a colon ":". You

@ -53,7 +53,7 @@ def get_suitable_downloader(info_dict, params={}, default=HttpFD):
external_downloader = params.get('external_downloader') external_downloader = params.get('external_downloader')
if external_downloader is not None: if external_downloader is not None:
ed = get_external_downloader(external_downloader) ed = get_external_downloader(external_downloader)
if ed.can_download(info_dict): if ed.can_download(info_dict, external_downloader):
return ed return ed
if protocol.startswith('m3u8'): if protocol.startswith('m3u8'):

@ -85,16 +85,16 @@ class ExternalFD(FileDownloader):
return self.params.get('external_downloader') return self.params.get('external_downloader')
@classmethod @classmethod
def available(cls): def available(cls, path=None):
return check_executable(cls.get_basename(), [cls.AVAILABLE_OPT]) return check_executable(path or cls.get_basename(), [cls.AVAILABLE_OPT])
@classmethod @classmethod
def supports(cls, info_dict): def supports(cls, info_dict):
return info_dict['protocol'] in cls.SUPPORTED_PROTOCOLS return info_dict['protocol'] in cls.SUPPORTED_PROTOCOLS
@classmethod @classmethod
def can_download(cls, info_dict): def can_download(cls, info_dict, path=None):
return cls.available() and cls.supports(info_dict) return cls.available(path) and cls.supports(info_dict)
def _option(self, command_option, param): def _option(self, command_option, param):
return cli_option(self.params, command_option, param) return cli_option(self.params, command_option, param)

@ -650,8 +650,8 @@ def parseOpts(overrideArguments=None):
'--external-downloader', '--external-downloader',
dest='external_downloader', metavar='NAME', dest='external_downloader', metavar='NAME',
help=( help=(
'Use the specified external downloader. ' 'Name or path of the external downloader to use. '
'Currently supports %s' % ', '.join(list_external_downloaders()))) 'Currently supports %s (Recommended: aria2c)' % ', '.join(list_external_downloaders())))
downloader.add_option( downloader.add_option(
'--downloader-args', '--external-downloader-args', '--downloader-args', '--external-downloader-args',
metavar='NAME:ARGS', dest='external_downloader_args', default={}, type='str', metavar='NAME:ARGS', dest='external_downloader_args', default={}, type='str',

Loading…
Cancel
Save