优化流程
This commit is contained in:
parent
d7877b3809
commit
136fe64328
2
main.py
2
main.py
@ -5,5 +5,5 @@ if __name__ == '__main__':
|
||||
# os.environ["https_proxy"] = "http://127.0.0.1:7890"
|
||||
# url = "https://rm01.xyz/books/f08668a4-0cbc-488e-95a7-3c71de0c7a31/1"
|
||||
# comicEntity.comicChapter(url,scramble=True)
|
||||
# comicEntity.oneComic("https://rm01.xyz/books/3104bc6f-bcf8-47a3-8383-2110f7fe6981")
|
||||
# comicEntity.oneComic("https://rm01.xyz/books/c94f80c1-a673-4c74-bb5e-ad5ac7dd766b")
|
||||
comicEntity.downladsComcis("https://rm01.xyz/books?&page=0")
|
||||
@ -22,6 +22,7 @@ class imageUtils:
|
||||
|
||||
@classmethod
|
||||
def scrambleImage(cls,file_path):
|
||||
#检测到未下载完的图像 直接返回None
|
||||
if str(file_path).endswith(".downloads"):
|
||||
os.remove(file_path)
|
||||
return None
|
||||
@ -31,7 +32,7 @@ class imageUtils:
|
||||
baseName = file_str[-1]
|
||||
baseFN = baseName.split("_")
|
||||
save_name = baseFN[1]
|
||||
save_name_delesu = baseName.split(".")[0]
|
||||
save_name_delesu = save_name.split(".")[0]
|
||||
blocks = int(baseFN[0])
|
||||
save_file_path = os.path.join(baseDir,save_name)
|
||||
print("sva",save_file_path)
|
||||
@ -75,7 +76,8 @@ class imageUtils:
|
||||
for r in range(rownum):
|
||||
for c in range(colnum):
|
||||
box=(c*colwidth,r*rowheight,(c+1)*colwidth,(r+1)*rowheight)
|
||||
file_path = os.path.join(dstpath,basename+'_'+str(num)+'.'+ext)
|
||||
count_image = "{:0>3d}".format(num)
|
||||
file_path = os.path.join(dstpath,str(count_image)+'.'+ext)
|
||||
print("file_path=",file_path)
|
||||
img.crop(box).save(file_path)
|
||||
num=num+1
|
||||
@ -114,7 +116,6 @@ class imageUtils:
|
||||
|
||||
@classmethod
|
||||
def getScrambleImage(cls,path):
|
||||
scrambleFileCache = cls.scrambleImage(path)
|
||||
if not scrambleFileCache == None:
|
||||
os.remove(str(scrambleFileCache))
|
||||
|
||||
scrambleFileCache = cls.scrambleImage(path)
|
||||
if os.path.exists(scrambleFileCache):
|
||||
os.remove(scrambleFileCache)
|
||||
@ -106,6 +106,7 @@ class comicEntity:
|
||||
comicInfo.nextInfoToImgChapter()
|
||||
#下载完成后, 开始解密图片
|
||||
if scramble:
|
||||
#获取章节图片路径
|
||||
chapter_dir = comicInfo.getDirComicChapter()
|
||||
dirs = os.listdir(chapter_dir)
|
||||
for img in dirs:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user