fix
This commit is contained in:
parent
244c1b8c39
commit
233e48da27
@ -94,6 +94,7 @@ class FileNaming:
|
|||||||
if is_update and remove:
|
if is_update and remove:
|
||||||
try:
|
try:
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
is_update = False
|
||||||
except:
|
except:
|
||||||
raise exit(f"file_update_by_date() {path} 删除失败")
|
raise exit(f"file_update_by_date() {path} 删除失败")
|
||||||
return is_update
|
return is_update
|
||||||
|
|||||||
@ -198,10 +198,10 @@ class MangaDownloader:
|
|||||||
|
|
||||||
async def download_image(self, session: aiohttp.ClientSession, url: str, save_path: Path, retries: int = RETRIES, timeout: int = TIMEOUT, use_proxy: bool = RETRY_PROXY) -> bool:
|
async def download_image(self, session: aiohttp.ClientSession, url: str, save_path: Path, retries: int = RETRIES, timeout: int = TIMEOUT, use_proxy: bool = RETRY_PROXY) -> bool:
|
||||||
"""下载单个图片,增加重试机制、超时等待和文件缓存机制"""
|
"""下载单个图片,增加重试机制、超时等待和文件缓存机制"""
|
||||||
FileNaming().file_update_by_date(save_path, remove=True)
|
|
||||||
if os.path.exists(FileNaming.getFileScrambleImageSave(save_path)): # 检查文件是否已存在
|
if os.path.exists(FileNaming.getFileScrambleImageSave(save_path)): # 检查文件是否已存在
|
||||||
logger.info(f"文件已存在,跳过下载: {save_path}")
|
if FileNaming().file_update_by_date(save_path, remove=True):
|
||||||
return True
|
logger.info(f"文件已存在,跳过下载: {save_path}")
|
||||||
|
return True
|
||||||
# 从缓存中获取图片
|
# 从缓存中获取图片
|
||||||
cached_images = self.cache.get_image(url)
|
cached_images = self.cache.get_image(url)
|
||||||
if cached_images:
|
if cached_images:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user