This commit is contained in:
cwx
2023-04-06 18:47:34 +08:00
parent 0320cf02fa
commit dc917c2fc6
8 changed files with 50 additions and 39 deletions
+7 -10
View File
@@ -63,7 +63,7 @@ class CBZUtils:
zf.write(path.joinpath(filename), arc_dir.joinpath(filename))
zf.close()
ntfy.sendMsg(f"打包完成:{target_file}")
cls.verCBZComic(target_file)
cls.isVerCBZComic(target_file)
@classmethod
def packAutoComicChapterCBZ(cls):
@@ -129,8 +129,10 @@ class CBZUtils:
return result
#CBZ检验是否完整
#正确True 错误False
@classmethod
def verCBZComic(cls,path=None,list_img=None,min_size=300000):
def isVerCBZComic(cls,path=None,list_img=None,min_size=300000):
is_ver = False
#数据检验
if path == None: path = cls.getCBZ_Path()
#文件不存在 则返回
@@ -150,7 +152,7 @@ class CBZUtils:
ciUtils.setProgressFail()
except Exception as e:
print(e)
return False
return is_ver
@classmethod
def isUpdateOldCBZ(cls,filesname=None,result=False):
@@ -176,10 +178,5 @@ class CBZUtils:
fu.remove(unzip_path)
return True
ci.writeComicInfoXML(overlay=True)
result = False
return result
@classmethod
def nextCBZ(cls,list_img=None):
if list_img == None: list_img = Comic.getChapterImgs()
return not cls.verCBZComic(list_img=list_img)
is_update = False
return is_update
+4 -8
View File
@@ -153,14 +153,9 @@ class imageUtils:
#image.show()
file_str = str(imgpath).split("=")
#10_29.jpg
base_dir = file_str[0].replace("scramble","")
base_name = file_str[-1]
base_fn = base_name.split("_")
save_name = base_fn[1]
save_name_delesu = save_name.split(".")[0]
base_fn = file_str[-1].split("_")
blocks = int(base_fn[0])
img_type = os.path.basename(imgpath).split('.')[-1]
save_path = os.path.join(os.path.dirname(imgpath),save_name_delesu+"."+img_type)
save_path = ComicPath.getFileScrambleImageSave(imgpath)
# print(type(aid),type(img_name))
if blocks:
s = blocks # 随机值
@@ -324,7 +319,8 @@ class dbUtils:
result = False
db = cls.init_db(db_name)
if db == None: return None
result = db.search(Query().name == name)
data = db.search(Query().name == name)
logger.info(f"result query= {data}")
if progress != None:
try:
if len(db.search((Query().name == name) & (Query().progress == progress))) != 0: result = True
+8 -4
View File
@@ -188,6 +188,13 @@ class downloadUtils:
result = cls.getDownUrlDirFileType()
if result == None: return None
(file_url,dir,file,file_type) = [result[0],result[1],result[2],result[3]]
logger.debug(f"file_url={file_url}, dir={dir} , file={file}, file_type={file_type}")
en_scrabmle_file = ComicPath.getFileScrambleImageSave(file)
save_path = os.path.join(dir,en_scrabmle_file)
logger.debug(f"save_path= {save_path}")
if os.path.exists(save_path):
logger.info(f"文件已存在,跳过中... {save_path}")
return True
if file_url == None:
logger.error("common_down file_url 为空")
raise NameError("common_down file_url为空")
@@ -197,7 +204,6 @@ class downloadUtils:
"http": proxy_type + "://" + proxy,
"https": proxy_type + "://" + proxy }
response = None
save_path = os.path.join(dir,file)
logger.debug(f"save_path {save_path}")
if not os.path.exists(dir): os.makedirs(dir)
temp_path = save_path+".downloads"
@@ -244,7 +250,5 @@ class downloadUtils:
with concurrent.futures.ThreadPoolExecutor(max_workers=concurrency) as executor:
future_list = list()
while not cls.QUEUE_DOWN.empty():
logger.debug("QUEUE_DOWN 不为空 准备下载中...")
future_list.append(executor.submit(
cls.common_download,timeout, proxy_type, proxy))
future_list.append(executor.submit(cls.common_download,timeout=timeout, proxy_type=proxy_type, proxy=proxy))
concurrent.futures.wait(future_list, timeout)