make download_one_file() more general
This commit is contained in:
4
core.py
4
core.py
@@ -223,7 +223,7 @@ 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 f'[+]Image Downloaded! {save_path}'
|
||||
return str(save_path)
|
||||
return None
|
||||
|
||||
def extrafanart_download_threadpool(url_list, save_dir, number, source_movie):
|
||||
@@ -243,7 +243,7 @@ def extrafanart_download_threadpool(url_list, save_dir, number, source_movie):
|
||||
with ThreadPoolExecutor(os.cpu_count()) as pool:
|
||||
result = pool.map(download_one_file, mp_args)
|
||||
for s in result:
|
||||
print(s) if s else None
|
||||
print('[+]Image Downloaded!', s) if s else None
|
||||
if not all(result): # 非致命错误,电影不移入失败文件夹,将来可以用模式3补齐
|
||||
print('[-]Failed download some extrafanart images for number [{number}], you may retry run mode 3 later.')
|
||||
if conf.debug():
|
||||
|
||||
Reference in New Issue
Block a user