map function call local function

This commit is contained in:
lededev
2021-11-03 20:14:06 +08:00
parent 1863ccb1e2
commit 0622b8bda3
2 changed files with 33 additions and 37 deletions

14
core.py
View File

@@ -217,14 +217,12 @@ def extrafanart_download_one_by_one(data, path, filepath):
print(f'[!]Extrafanart download one by one mode runtime {time.perf_counter() - tm_start:.3f}s')
def download_one_file(args):
return _download_one_file(*args)
def _download_one_file(url: str, save_path: Path):
filebytes = get_html(url, return_type='content')
if isinstance(filebytes, bytes) and len(filebytes):
if len(filebytes) == save_path.open('wb').write(filebytes):
return str(save_path)
return None
def _inner(url: str, save_path: Path):
filebytes = get_html(url, return_type='content')
if isinstance(filebytes, bytes) and len(filebytes):
if len(filebytes) == save_path.open('wb').write(filebytes):
return str(save_path)
return _inner(*args)
def extrafanart_download_threadpool(url_list, save_dir, number):
tm_start = time.perf_counter()