diff --git a/youtube_dl/downloader/common.py b/youtube_dl/downloader/common.py index 1cdba89cd..362358508 100644 --- a/youtube_dl/downloader/common.py +++ b/youtube_dl/downloader/common.py @@ -58,7 +58,7 @@ class FileDownloader(object): _TEST_FILE_SIZE = 10241 params = None - def __init__(self, ydl, params): + def __init__(self, ydl, params: dict): """Create a FileDownloader object with the given options.""" self.ydl = ydl self._progress_hooks = [] diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py index 072f7c1fe..0ed7907b2 100644 --- a/youtube_dl/downloader/external.py +++ b/youtube_dl/downloader/external.py @@ -216,8 +216,8 @@ class Aria2pFD(ExternalFD): ''' AVAILABLE_OPT = 'show' - def _call_downloader(self, tmpfilename, info_dict): - try: + def _call_downloader(self, tmpfilename: str, info_dict: dict): + try: aria2 = aria2p.API( aria2p.Client( host="http://localhost", @@ -238,20 +238,15 @@ class Aria2pFD(ExternalFD): options["min-split-size"] = "1M" options["max-connection-per-server"] = 4 options["auto-file-renaming"] = "false" - dn = os.path.dirname(tmpfilename) - if dn: - options["dir"] = dn + download_dir = os.path.dirname(tmpfilename) + if download_dir: + options["dir"] = download_dir else: options["dir"] = os.path.abspath('.') options["out"] = os.path.basename(tmpfilename) options["header"] = [] for key, val in info_dict['http_headers'].items(): 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) while download.status == "active": download = aria2.get_download(download.gid)