fix
This commit is contained in:
+2
-2
@@ -156,8 +156,8 @@ class CBZUtils:
|
||||
|
||||
@classmethod
|
||||
def updateOldCBZ(cls,filesname,result=False):
|
||||
old_zipfile_path = ComicPath.setJoinPathDir([OldUtils.getOldComicName(),OldUtils.getOldChapter()],
|
||||
pathStr.old_cbz_path,prefix="CBZ")
|
||||
old_zipfile_path = ComicPath.getPathOldCBZComicChapter()
|
||||
|
||||
#判断是否存在已下载CBZ文件
|
||||
if fu.exists(old_zipfile_path) and fu.notExists(CBZUtils.getCBZ_Path()):
|
||||
print(f"存在CBZ文件{old_zipfile_path},解压中...")
|
||||
|
||||
+5
-5
@@ -55,7 +55,7 @@ class imageUtils:
|
||||
block_height = int(height / blocks)
|
||||
block_width = int(width / blocks)
|
||||
print("blockHeight=",block_height)
|
||||
prefix = str(file_path).split(".")[-1]
|
||||
suffix = str(file_path).split(".")[-1]
|
||||
split_path = os.path.join(base_dir,save_name_delesu+"split")
|
||||
if image_su == "downloads":
|
||||
return None
|
||||
@@ -242,7 +242,7 @@ class fileUtils:
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def dirFilesName(cls,path,type="file",prefix=None):
|
||||
def dirFilesName(cls,path,type="file",suffix=None):
|
||||
result = []
|
||||
if cls.exists(path):
|
||||
for file_or_dir in os.listdir(path):
|
||||
@@ -251,11 +251,11 @@ class fileUtils:
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def equImages(cls,dir,files,prefix=".jpg"):
|
||||
def equImages(cls,dir,files,suffix=".jpg"):
|
||||
len_count = 0
|
||||
file_names = cls.dirFilesName(dir,"file")
|
||||
for file in file_names:
|
||||
if str(file).endswith(prefix): len_count += 1
|
||||
if str(file).endswith(suffix): len_count += 1
|
||||
return len_count == len(files)
|
||||
|
||||
@classmethod
|
||||
@@ -304,7 +304,7 @@ class fileUtils:
|
||||
class dbUtils:
|
||||
@classmethod
|
||||
def init_db(cls,db_name):
|
||||
return TinyDB(ComicPath.getDirConfDefault(db_name,prefix="json"))
|
||||
return TinyDB(ComicPath.getDirConfDefault(db_name,suffix="json"))
|
||||
|
||||
@classmethod
|
||||
def set(cls,name,progress,db_name):
|
||||
|
||||
+7
-7
@@ -223,7 +223,7 @@ class downloadUtils:
|
||||
:param proxy_type:
|
||||
:param image_urls: list of image urls
|
||||
:param dst_dir: output the downloaded images to dst_dir
|
||||
:param file_prefix: if set to "img", files will be in format "img_xxx.jpg"
|
||||
:param file_suffix: if set to "img", files will be in format "img_xxx.jpg"
|
||||
:param concurrency: number of requests process simultaneously
|
||||
:return: none
|
||||
"""
|
||||
@@ -249,15 +249,15 @@ class downloadUtils:
|
||||
print("icon 不存在,已跳过")
|
||||
return None
|
||||
save_name = ci.COMIC_ICON_NAME
|
||||
icon_prefix = "."+str(icon_url).split(".")[-1]
|
||||
icon_prefix = icon_prefix.split("?")[0]
|
||||
icon_suffix = "."+str(icon_url).split(".")[-1]
|
||||
icon_suffix = icon_suffix.split("?")[0]
|
||||
#判断漫画名路径是否已存在comicname/cover.jpg, 存在跳过
|
||||
path_comic_icon = os.path.join(ComicPath.getDirConfComic(),save_name+icon_prefix)
|
||||
path_comic_icon = os.path.join(ComicPath.getDirConfComic(),save_name+icon_suffix)
|
||||
if not ciUtils.equIcon() and fu.exists(path_comic_icon):
|
||||
os.remove(path_comic_icon)
|
||||
if fu.notExists(path_comic_icon):
|
||||
cls.download_images([icon_url],ComicPath.getDirConfComic(),files_name=[save_name+icon_prefix])
|
||||
save_path = os.path.join(ComicPath.getDirCBZComic(),Comic.getChapterName()+icon_prefix)
|
||||
cls.download_images([icon_url],ComicPath.getDirConfComic(),files_name=[save_name+icon_suffix])
|
||||
save_path = os.path.join(ComicPath.getDirCBZComic(),Comic.getChapterName()+icon_suffix)
|
||||
if is_new:
|
||||
#历史版本ICON
|
||||
if os.path.exists(save_path):
|
||||
@@ -265,7 +265,7 @@ class downloadUtils:
|
||||
if os.path.exists(path_comic_icon):
|
||||
base_dir = ComicPath.getDirComicChapter()
|
||||
if not os.path.exists(base_dir): os.makedirs(base_dir)
|
||||
shutil.copy(path_comic_icon,os.path.join(base_dir,save_name+icon_prefix))
|
||||
shutil.copy(path_comic_icon,os.path.join(base_dir,save_name+icon_suffix))
|
||||
else:
|
||||
if fu.notExists(ComicPath.getDirCBZComic()): os.makedirs(ComicPath.getDirCBZComic())
|
||||
shutil.copy(path_comic_icon,save_path)
|
||||
|
||||
Reference in New Issue
Block a user