diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-04-10 20:38:33 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-04-10 20:57:52 +0530 |
commit | 52a8a1e1b93dbc88f0018d4842f1e90ba96e095f (patch) | |
tree | 3708a1e4cd100657896d6aef0eb0f1352fc7cc3d /yt_dlp/downloader/external.py | |
parent | d818eb747361117ec86a5c4fe217d5d6956f36d3 (diff) | |
download | hypervideo-pre-52a8a1e1b93dbc88f0018d4842f1e90ba96e095f.tar.lz hypervideo-pre-52a8a1e1b93dbc88f0018d4842f1e90ba96e095f.tar.xz hypervideo-pre-52a8a1e1b93dbc88f0018d4842f1e90ba96e095f.zip |
Option to choose different downloader for different protocols
* Renamed `--external-downloader-args` to `--downloader-args`
* Added `native` as an option for the downloader
* Use similar syntax to `--downloader-args` etc. Eg: `--downloader dash:native --downloader aria2c`
* Deprecated `--hls-prefer-native` and `--hls-prefer-ffmpeg` since the same can now be done with `--downloader "m3u8:native"` and `m3u8:ffmpeg` respectively
* Split `frag_urls` protocol into `m3u8_frag_urls` and `dash_frag_urls`
* Standardize shortening of protocol names with `downloader.shorten_protocol_name`
Diffstat (limited to 'yt_dlp/downloader/external.py')
-rw-r--r-- | yt_dlp/downloader/external.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py index 63e430ac9..ea2e6eb12 100644 --- a/yt_dlp/downloader/external.py +++ b/yt_dlp/downloader/external.py @@ -81,11 +81,15 @@ class ExternalFD(FileDownloader): @property def exe(self): - return self.params.get('external_downloader') + return self.get_basename() @classmethod def available(cls, path=None): - return check_executable(path or cls.get_basename(), [cls.AVAILABLE_OPT]) + path = check_executable(path or cls.get_basename(), [cls.AVAILABLE_OPT]) + if path: + cls.exe = path + return path + return False @classmethod def supports(cls, info_dict): @@ -259,7 +263,7 @@ class WgetFD(ExternalFD): class Aria2cFD(ExternalFD): AVAILABLE_OPT = '-v' - SUPPORTED_PROTOCOLS = ('http', 'https', 'ftp', 'ftps', 'frag_urls') + SUPPORTED_PROTOCOLS = ('http', 'https', 'ftp', 'ftps', 'dash_frag_urls', 'm3u8_frag_urls') @staticmethod def supports_manifest(manifest): @@ -310,9 +314,11 @@ class Aria2cFD(ExternalFD): class HttpieFD(ExternalFD): + AVAILABLE_OPT = '--version' + @classmethod def available(cls, path=None): - return check_executable(path or 'http', ['--version']) + return ExternalFD.available(cls, path or 'http') def _make_cmd(self, tmpfilename, info_dict): cmd = ['http', '--download', '--output', tmpfilename, info_dict['url']] @@ -327,7 +333,8 @@ class FFmpegFD(ExternalFD): SUPPORTED_PROTOCOLS = ('http', 'https', 'ftp', 'ftps', 'm3u8', 'rtsp', 'rtmp', 'mms') @classmethod - def available(cls, path=None): # path is ignored for ffmpeg + def available(cls, path=None): + # TODO: Fix path for ffmpeg return FFmpegPostProcessor().available def _call_downloader(self, tmpfilename, info_dict): @@ -484,4 +491,4 @@ def get_external_downloader(external_downloader): downloader . """ # Drop .exe extension on Windows bn = os.path.splitext(os.path.basename(external_downloader))[0] - return _BY_NAME[bn] + return _BY_NAME.get(bn) |