fix
This commit is contained in:
1 parent
2b47018f27
commit
936aaf1a59
2 files changed
+22
-4
No files matched your search
+18
-1
@@ -47,7 +47,7 @@ class imageUtils:
|
|||||||
try:
|
try:
|
||||||
img = Image.open(file_path)
|
img = Image.open(file_path)
|
||||||
except:
|
except:
|
||||||
print(f"error Image")
|
print(f"error Image: {file_path}")
|
||||||
width = img.width
|
width = img.width
|
||||||
height = img.height
|
height = img.height
|
||||||
#blocks = cls.encodeImage(enStr)
|
#blocks = cls.encodeImage(enStr)
|
||||||
@@ -241,6 +241,23 @@ class fileUtils:
|
|||||||
print(e)
|
print(e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def dirFilesName(cls,path,type="file",prefix=None):
|
||||||
|
result = []
|
||||||
|
if cls.exists(path):
|
||||||
|
for file_or_dir in os.listdir(path):
|
||||||
|
if type == "file" and os.path.isfile(os.path.join(path,file_or_dir)): result.append(file_or_dir)
|
||||||
|
if type == "dir" and os.path.isdir(os.path.join(path,file_or_dir)): result.append(file_or_dir)
|
||||||
|
return result
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def equImages(cls,dir,files,prefix=".jpg"):
|
||||||
|
len_count = 0
|
||||||
|
file_names = cls.dirFilesName(dir,"file")
|
||||||
|
for file in file_names:
|
||||||
|
if str(file).endswith(prefix): len_count += 1
|
||||||
|
return len_count == len(files)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def remove(cls,path):
|
def remove(cls,path):
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
|
|||||||
@@ -120,13 +120,14 @@ class baseComic:
|
|||||||
#检验CBZ文件
|
#检验CBZ文件
|
||||||
CBZUtils.verCBZComic(cbz_file)
|
CBZUtils.verCBZComic(cbz_file)
|
||||||
CBZUtils.updateOldCBZ(files_name)
|
CBZUtils.updateOldCBZ(files_name)
|
||||||
|
is_next = CBZUtils.nextCBZ()
|
||||||
#不存在ComicInfo.xml则生成
|
#不存在ComicInfo.xml则生成
|
||||||
if is_next and fu.notExists(ci.getPathComicInfoXML()): ci.writeComicInfoXML(chapter_name)
|
if is_next and fu.notExists(ci.getPathComicInfoXML()): ci.writeComicInfoXML(chapter_name)
|
||||||
repeat = 1
|
repeat = 1
|
||||||
while CBZUtils.nextCBZ() and repeat <= 10:
|
while is_next and repeat <= 10:
|
||||||
ntfy.sendMsg(f"{book_name} {chapter_name} 下载中")
|
ntfy.sendMsg(f"{book_name} {chapter_name} 下载中")
|
||||||
download_images(list_img,ci.getDirComicChapter(), files_name=files_name,concurrency=None,timeout=8)
|
download_images(list_img,ci.getDirComicChapter(), files_name=files_name,concurrency=None,timeout=8)
|
||||||
equ_next = len(",".join(os.listdir(ci.getDirComicChapter())).split(".jpg")) == len(list_img)
|
is_next = fu.equImages(ci.getDirComicChapter(),list_img)
|
||||||
if not equ_next: ntfy.sendMsg(msg=f"下载数据(不完整,{int(repeat*2)}秒钟后尝试第{repeat}次",sleep=int(repeat*2))
|
if not is_next: ntfy.sendMsg(msg=f"下载数据(不完整,{int(repeat*2)}秒钟后尝试第{repeat}次",sleep=int(repeat*2))
|
||||||
repeat += 1
|
repeat += 1
|
||||||
return is_next
|
return is_next
|
||||||
Reference in new issue
Block a user