|
|
|
@ -13,6 +13,7 @@ from ..compat import (
|
|
|
|
|
)
|
|
|
|
|
from ..postprocessor.ffmpeg import FFmpegPostProcessor, EXT_TO_OUT_FORMATS
|
|
|
|
|
from ..utils import (
|
|
|
|
|
classproperty,
|
|
|
|
|
cli_option,
|
|
|
|
|
cli_valueless_option,
|
|
|
|
|
cli_bool_option,
|
|
|
|
@ -73,17 +74,23 @@ class ExternalFD(FragmentFD):
|
|
|
|
|
def get_basename(cls):
|
|
|
|
|
return cls.__name__[:-2].lower()
|
|
|
|
|
|
|
|
|
|
@classproperty
|
|
|
|
|
def EXE_NAME(cls):
|
|
|
|
|
return cls.get_basename()
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def exe(self):
|
|
|
|
|
return self.get_basename()
|
|
|
|
|
return self.EXE_NAME
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def available(cls, path=None):
|
|
|
|
|
path = check_executable(path or cls.get_basename(), [cls.AVAILABLE_OPT])
|
|
|
|
|
if path:
|
|
|
|
|
cls.exe = path
|
|
|
|
|
return path
|
|
|
|
|
return False
|
|
|
|
|
path = check_executable(
|
|
|
|
|
cls.EXE_NAME if path in (None, cls.get_basename()) else path,
|
|
|
|
|
[cls.AVAILABLE_OPT])
|
|
|
|
|
if not path:
|
|
|
|
|
return False
|
|
|
|
|
cls.exe = path
|
|
|
|
|
return path
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def supports(cls, info_dict):
|
|
|
|
@ -106,7 +113,7 @@ class ExternalFD(FragmentFD):
|
|
|
|
|
|
|
|
|
|
def _configuration_args(self, keys=None, *args, **kwargs):
|
|
|
|
|
return _configuration_args(
|
|
|
|
|
self.get_basename(), self.params.get('external_downloader_args'), self.get_basename(),
|
|
|
|
|
self.get_basename(), self.params.get('external_downloader_args'), self.EXE_NAME,
|
|
|
|
|
keys, *args, **kwargs)
|
|
|
|
|
|
|
|
|
|
def _call_downloader(self, tmpfilename, info_dict):
|
|
|
|
@ -306,10 +313,7 @@ class Aria2cFD(ExternalFD):
|
|
|
|
|
|
|
|
|
|
class HttpieFD(ExternalFD):
|
|
|
|
|
AVAILABLE_OPT = '--version'
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def available(cls, path=None):
|
|
|
|
|
return super().available(path or 'http')
|
|
|
|
|
EXE_NAME = 'http'
|
|
|
|
|
|
|
|
|
|
def _make_cmd(self, tmpfilename, info_dict):
|
|
|
|
|
cmd = ['http', '--download', '--output', tmpfilename, info_dict['url']]
|
|
|
|
@ -510,11 +514,13 @@ class AVconvFD(FFmpegFD):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_BY_NAME = dict(
|
|
|
|
|
(klass.get_basename(), klass)
|
|
|
|
|
_BY_NAME = {
|
|
|
|
|
klass.get_basename(): klass
|
|
|
|
|
for name, klass in globals().items()
|
|
|
|
|
if name.endswith('FD') and name not in ('ExternalFD', 'FragmentFD')
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_BY_EXE = {klass.EXE_NAME: klass for klass in _BY_NAME.values()}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def list_external_downloaders():
|
|
|
|
@ -526,4 +532,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.get(bn)
|
|
|
|
|
return _BY_NAME.get(bn, _BY_EXE.get(bn))
|
|
|
|
|