From d65c27599ad6cca412315fc20d5c5528cc90ade8 Mon Sep 17 00:00:00 2001 From: caiwx86 Date: Thu, 14 Nov 2024 19:01:34 +0800 Subject: [PATCH] fix --- Comics/pipelines.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Comics/pipelines.py b/Comics/pipelines.py index 274b482..d0e84c1 100644 --- a/Comics/pipelines.py +++ b/Comics/pipelines.py @@ -122,10 +122,10 @@ class ImgDownloadPipeline(BaseImagesPipeline): # super().update_icon(item) cbz_path = super().get_file_path(item, result_type="cbz") chapter_dir = ComicPath(item=item).file_path(result_type=ComicPath().MAPPING_IMAGES_DIR) - images_file = oldUtils().old_images(folder=chapter_dir) - images_urls = ComicLoader(item=item).get_image_urls() + # images_file = oldUtils().old_images(folder=chapter_dir) + # images_urls = ComicLoader(item=item).get_image_urls() # 校验数据是正确 - if len(images_file) != len(images_urls) or len(images_urls) == 0: return + # if len(images_file) != len(images_urls) or len(images_urls) == 0: return super().update_icon(item) # CBZ文件是否已存在 if fu.exists(cbz_path): @@ -142,8 +142,8 @@ class ImgDownloadPipeline(BaseImagesPipeline): if CBZUtils.comicChapterCBZPack(src_dir= chapter_dir, dts_path= cbz_path, remove=False): super().update_icon(item) self.pack_icon(item) - - def item_completed(self, results, item, info): + + def down_image(self, item): """图片下载完成,开始CBZ打包 不再做数据完整检验,CBZUtils后续会自动检验 传入图像路径即可 @@ -174,6 +174,11 @@ class ImgDownloadPipeline(BaseImagesPipeline): # logging.info(f"downloading {image_url} --> IMAGE_STORE {image_path}") down_queue.append((image_url, os.path.join(IMAGES_STORE, image_path))) if len(down_queue) > 0: - download_images(down_queue) + download_images(down_queue, max_retries=5) + + def item_completed(self, results, item, info): + cbz_path = super().get_file_path(item, result_type="cbz") + if not fu.exists(cbz_path): + self.down_image(item) # 存在未下载图像数据则重试 self.download_done(item) \ No newline at end of file