This commit is contained in:
caiwx86 2025-02-05 02:14:17 +08:00
parent 98c47acea7
commit c9069f5b1e

View File

@ -342,7 +342,7 @@ class CBZUtils:
for file in filenames: for file in filenames:
# 假设图片格式为 JPG 或 ComicInfo.xml # 假设图片格式为 JPG 或 ComicInfo.xml
count += 1 count += 1
print("打包中:" + str(count) + "/" + str(len(filenames)), os.path.join(source_dir, file.name)) logger.debug("打包中:" + str(count) + "/" + str(len(filenames)), os.path.join(source_dir, file.name))
cbz.write(file, arcname=file.name) cbz.write(file, arcname=file.name)
cbz.close() cbz.close()
logger.info(f"打包完成:{target_file}{count} 个文件") logger.info(f"打包完成:{target_file}{count} 个文件")
@ -372,15 +372,15 @@ class CBZUtils:
try: try:
ImageUtils.deScrambleImagesByPath(os.path.join(chapter_dir,file)) ImageUtils.deScrambleImagesByPath(os.path.join(chapter_dir,file))
except Exception as e: except Exception as e:
print(f"删除 {file} 发生错误 {e},已跳过") logger.error(f"删除 {file} 发生错误 {e},已跳过")
return False return False
if self._zip_compression(source_dir=chapter_dir, target_file=self.cbz_path, remove=False): if self._zip_compression(source_dir=chapter_dir, target_file=self.cbz_path, remove=False):
logger.info(f"章节 {chapter_dir.name} 打包完成: {self.cbz_path}") logger.debug(f"章节 {chapter_dir.name} 打包完成: {self.cbz_path}")
time.sleep(0.5) time.sleep(0.5)
if clear_chapter: if clear_chapter:
try: try:
shutil.rmtree(chapter_dir) shutil.rmtree(chapter_dir)
logger.info(f"{chapter_dir} 章节原图片已删除") logger.debug(f"{chapter_dir} 章节原图片已删除")
except: except:
raise exit(f"{chapter_dir} 章节删除错误") raise exit(f"{chapter_dir} 章节删除错误")
else: else:
@ -526,7 +526,7 @@ class ImageUtils:
save_file_path = os.path.join(base_dir,save_name) save_file_path = os.path.join(base_dir,save_name)
print("sva",save_file_path) print("sva",save_file_path)
if os.path.exists(save_file_path): if os.path.exists(save_file_path):
print("图片已解密,已跳过:", save_file_path) logger.debug("图片已解密,已跳过:", save_file_path)
return None return None
image_su = str(file_path).split(".")[-1] image_su = str(file_path).split(".")[-1]
try: try:
@ -678,7 +678,7 @@ class ImageUtils:
newh += b_h newh += b_h
newimage.save(save_path) newimage.save(save_path)
logging.info(f"解密成功 {save_path}") logging.debug(f"解密成功 {save_path}")
if os.path.exists(img_path): if os.path.exists(img_path):
os.remove(img_path) os.remove(img_path)
logging.debug(f"remove {img_path}") logging.debug(f"remove {img_path}")