fix icons
This commit is contained in:
1 parent
e23c34e29b
commit
5449ca87b6
1 file changed
+13
-9
+13
-9
@@ -156,7 +156,10 @@ class BaseSite(ABC):
|
||||
return list_cover
|
||||
|
||||
async def update_cbz_covers(self, manga_info : MangaInfo):
|
||||
"""更新CBZ漫画的Cover"""
|
||||
"""<h1>更新CBZ漫画的Cover</h1>
|
||||
<h2>参数</h2>
|
||||
<p><strong>manga_info</strong>: 漫画信息对象</p>
|
||||
"""
|
||||
cbz_dir = DirectoryNaming().chapter_cbz_dir(manga_info=manga_info)
|
||||
list_cbz = list(FileNaming().get_filenames_optimized(cbz_dir, ext_filter=[".CBZ"]))
|
||||
|
||||
@@ -166,21 +169,22 @@ class BaseSite(ABC):
|
||||
list_file_img = []
|
||||
|
||||
for cbz_path in list_cbz:
|
||||
first_cover_path = str(cbz_path).split(".")[0]+".jpg"
|
||||
cover_path_prefix = str(cbz_path).split(".")[0]+".jpg"
|
||||
if len(list_cover) == 1:
|
||||
if FileNaming().file_update_by_date(first_cover_path, day=30) or not os.path.exists(first_cover_path):
|
||||
shutil.copy(list_cover[0].path, first_cover_path)
|
||||
list_file_img.append(first_cover_path)
|
||||
logger.info(f"{list_cover[0].path} ==> {first_cover_path} 已复制")
|
||||
# 如果只有一个Cover封面
|
||||
if FileNaming().file_update_by_date(cover_path_prefix, day=30) or not os.path.exists(cover_path_prefix):
|
||||
shutil.copy(list_cover[0].path, cover_path_prefix)
|
||||
list_file_img.append(cover_path_prefix)
|
||||
logger.info(f"{list_cover[0].path} ==> {cover_path_prefix} 已复制")
|
||||
else:
|
||||
list_file_img.append(first_cover_path)
|
||||
list_file_img.append(cover_path_prefix)
|
||||
continue
|
||||
cover_count = 1
|
||||
for cover in list_cover:
|
||||
cover_path = cover.path
|
||||
if os.path.exists(first_cover_path): os.remove(first_cover_path)
|
||||
# if os.path.exists(cover_path_prefix): os.remove(cover_path_prefix)
|
||||
new_cover_path = FileNaming().cover_format_path(str(cbz_path).split(".")[0]+".jpg", count=cover_count)
|
||||
if FileNaming().file_update_by_date(new_cover_path, day=30) or not os.path.exists(new_cover_path):
|
||||
if not os.path.exists(new_cover_path):
|
||||
shutil.copy(cover_path, new_cover_path)
|
||||
list_file_img.append(new_cover_path)
|
||||
logger.info(f"{cover_path} ==> {new_cover_path} 已复制")
|
||||
|
||||
Reference in new issue
Block a user