feat: change value name

This commit is contained in:
teddy171 2023-01-26 19:36:34 +08:00
parent 6175fa7066
commit 8845e952ae
2 changed files with 6 additions and 11 deletions

View File

@ -58,7 +58,7 @@ class FileDownloader(object):
_TEST_FILE_SIZE = 10241 _TEST_FILE_SIZE = 10241
params = None params = None
def __init__(self, ydl, params): def __init__(self, ydl, params: dict):
"""Create a FileDownloader object with the given options.""" """Create a FileDownloader object with the given options."""
self.ydl = ydl self.ydl = ydl
self._progress_hooks = [] self._progress_hooks = []

View File

@ -216,7 +216,7 @@ class Aria2pFD(ExternalFD):
''' '''
AVAILABLE_OPT = 'show' AVAILABLE_OPT = 'show'
def _call_downloader(self, tmpfilename, info_dict): def _call_downloader(self, tmpfilename: str, info_dict: dict):
try: try:
aria2 = aria2p.API( aria2 = aria2p.API(
aria2p.Client( aria2p.Client(
@ -238,20 +238,15 @@ class Aria2pFD(ExternalFD):
options["min-split-size"] = "1M" options["min-split-size"] = "1M"
options["max-connection-per-server"] = 4 options["max-connection-per-server"] = 4
options["auto-file-renaming"] = "false" options["auto-file-renaming"] = "false"
dn = os.path.dirname(tmpfilename) download_dir = os.path.dirname(tmpfilename)
if dn: if download_dir:
options["dir"] = dn options["dir"] = download_dir
else: else:
options["dir"] = os.path.abspath('.') options["dir"] = os.path.abspath('.')
options["out"] = os.path.basename(tmpfilename) options["out"] = os.path.basename(tmpfilename)
options["header"] = [] options["header"] = []
for key, val in info_dict['http_headers'].items(): for key, val in info_dict['http_headers'].items():
options["header"].append(f"{key}: {val}") options["header"].append(f"{key}: {val}")
# cmd += self._option('--interface', 'source_address')
# cmd += self._option('--all-proxy', 'proxy')
# cmd += self._bool_option('--check-certificate', 'nocheckcertificate', 'false', 'true', '=')
# cmd += self._bool_option('--remote-time', 'updatetime', 'true', 'false', '=')
# cmd += ["call", "adduri", "-J", "[[\"{}\"], {}]".format(info_dict['url'], str(options)).replace("'", '"')]
download = aria2.add_uris([info_dict['url']], options) download = aria2.add_uris([info_dict['url']], options)
while download.status == "active": while download.status == "active":
download = aria2.get_download(download.gid) download = aria2.get_download(download.gid)