fix
This commit is contained in:
parent
7542152145
commit
a470f53317
@ -1,9 +1,10 @@
|
||||
import json
|
||||
import os
|
||||
import os,shutil
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile
|
||||
from utils.comic.ComicInfo import comicInfo
|
||||
from utils.Ntfy import ntfy
|
||||
from utils.FileUtils import fileUtils
|
||||
|
||||
class CBZUtils:
|
||||
|
||||
@ -88,7 +89,34 @@ class CBZUtils:
|
||||
data = zfile.namelist()
|
||||
zfile.close()
|
||||
return data
|
||||
|
||||
|
||||
@classmethod
|
||||
def replaceZip(cls,filepath,unpack_dir=None):
|
||||
if unpack_dir == None:
|
||||
unpack_dir = str(filepath).split(".")[0]
|
||||
fz = ZipFile(filepath, 'r')
|
||||
for file in fz.namelist():
|
||||
fz.extract(file, unpack_dir)
|
||||
zip_imgs = os.listdir(unpack_dir)
|
||||
is_file = None
|
||||
for img in zip_imgs:
|
||||
if img.endswith(".jpg"):
|
||||
file_path = os.path.join(unpack_dir,img)
|
||||
is_file = fileUtils.ver_file(file_path,"image")
|
||||
if is_file != None and is_file == False:
|
||||
shutil.rmtree(unpack_dir)
|
||||
os.remove(file_path)
|
||||
print(f"已删除{file_path}")
|
||||
else:
|
||||
print(f"数据完整:{file_path}")
|
||||
# 删除删除main.ftl文件
|
||||
#delete_filename = ''
|
||||
#if os.path.exists(delete_filename):
|
||||
# os.remove(delete_filename)
|
||||
# time.sleep(60)
|
||||
# shutil.copy(文件的路径,另一个目录);拷贝main.ftl到准备压缩的目录下
|
||||
#cls.zip_compression()
|
||||
|
||||
class verUtils:
|
||||
@classmethod
|
||||
def verCBZ(cls,data=None):
|
||||
|
||||
@ -37,8 +37,9 @@ class baseComic:
|
||||
for chapter in chapters:
|
||||
comicInfo.setChapterIndex(chapter_index)
|
||||
comicInfo.setChapterName(chapter)
|
||||
comicInfo.getNewCBZComicChapter()
|
||||
cbz_path = comicInfo.getNewCBZComicChapter()
|
||||
comicInfo.getNewIconComicChapter()
|
||||
CBZUtils.replaceZip(cbz_path)
|
||||
chapter_index = chapter_index + 1
|
||||
return None
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user