This commit is contained in:
caiwx86 2023-01-16 02:31:42 +08:00
parent 79e35f994e
commit 193d2d904b

View File

@ -1,5 +1,6 @@
import json import json
import os,shutil import os,shutil
from datetime import datetime
from pathlib import Path from pathlib import Path
from zipfile import ZipFile from zipfile import ZipFile
from utils.comic.ComicInfo import comicInfo from utils.comic.ComicInfo import comicInfo
@ -98,19 +99,15 @@ class CBZUtils:
for file in fz.namelist(): for file in fz.namelist():
fz.extract(file, unpack_dir) fz.extract(file, unpack_dir)
zip_imgs = os.listdir(unpack_dir) zip_imgs = os.listdir(unpack_dir)
is_file = []
for img in zip_imgs: for img in zip_imgs:
if img.endswith(".jpg"): if img.endswith(".jpg"):
file_path = os.path.join(unpack_dir,img) img_path = os.path.join(unpack_dir,img)
is_file.append(str(fileUtils.ver_file(file_path,"image"))) is_file = fileUtils.ver_file(img_path,"image")
is_file = ",".join(is_file) if not is_file and os.path.exists(filepath):
if len(is_file) != 0 and "False" in is_file: os.remove(filepath)
print(f"数据不完整,已删除:{filepath}")
if os.path.exists(unpack_dir):
shutil.rmtree(unpack_dir) shutil.rmtree(unpack_dir)
os.remove(file_path)
print(f"已删除{file_path}")
else:
shutil.rmtree(unpack_dir)
print(f"数据完整:{file_path}")
# 删除删除main.ftl文件 # 删除删除main.ftl文件
#delete_filename = '' #delete_filename = ''
#if os.path.exists(delete_filename): #if os.path.exists(delete_filename):