This commit is contained in:
caiwx86 2022-12-06 15:21:22 +08:00
parent f948382084
commit 63cf4a4e59
2 changed files with 6 additions and 9 deletions

View File

@ -19,7 +19,7 @@ class CBZUtils:
return data return data
@classmethod @classmethod
def zip_compression(cls,source_dir, target_file,type=None): def zip_compression(cls,source_dir, target_file):
msg = {} msg = {}
target_dir = os.path.dirname(target_file) target_dir = os.path.dirname(target_file)
if not os.path.exists(target_dir): if not os.path.exists(target_dir):
@ -44,10 +44,6 @@ class CBZUtils:
else: else:
print("文件已存在:", target_file) print("文件已存在:", target_file)
if type == "delete":
shutil.rmtree(source_dir)
print(f"已删除 source_dir: {source_dir}")
@classmethod @classmethod
def packAutoComicChapterCBZ(cls): def packAutoComicChapterCBZ(cls):
chapter_path = comicInfo.getDirComicChapter() chapter_path = comicInfo.getDirComicChapter()

View File

@ -1,8 +1,5 @@
import json,os,time,random import json,os,time,random,shutil
from utils.comic.ComicStr import comicStr
from utils.ComicUtils import comicUtils from utils.ComicUtils import comicUtils
from utils.FileUtils import fileUtils
from utils.comic.PathStr import pathStr
from utils.NetUtils import netUtils from utils.NetUtils import netUtils
from utils.HtmlUtils import htmlUtils from utils.HtmlUtils import htmlUtils
from utils.ImageUtils import imageUtils from utils.ImageUtils import imageUtils
@ -93,6 +90,10 @@ class comicEntity:
if comicInfo.nextExistsGetPath("cbz_"): if comicInfo.nextExistsGetPath("cbz_"):
#下载后自动打包 #下载后自动打包
CBZUtils.packAutoComicChapterCBZ() CBZUtils.packAutoComicChapterCBZ()
#完成删除原文件
remove_path = comicInfo.getDirComicChapter()
shutil.rmtree(remove_path)
print(f"文件已删除: {remove_path}")
if not sleep == None: if not sleep == None:
print(f"{sleep} 秒后开始下载下一个章节") print(f"{sleep} 秒后开始下载下一个章节")
time.sleep(sleep) time.sleep(sleep)