From 5449ca87b672eb7150e6b2e4aea27059a0d2dadb Mon Sep 17 00:00:00 2001 From: caiwx86 Date: Fri, 11 Sep 2026 23:50:42 +0800 Subject: [PATCH] fix icons --- src/sites/base.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/sites/base.py b/src/sites/base.py index c303b48..642696b 100644 --- a/src/sites/base.py +++ b/src/sites/base.py @@ -156,7 +156,10 @@ class BaseSite(ABC): return list_cover async def update_cbz_covers(self, manga_info : MangaInfo): - """更新CBZ漫画的Cover""" + """

更新CBZ漫画的Cover

+

参数

+

manga_info: 漫画信息对象

+ """ 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} 已复制")