This commit is contained in:
caiwx86 2024-11-14 19:01:34 +08:00
parent 1f39eb92ab
commit d65c27599a

View File

@ -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):
@ -143,7 +143,7 @@ class ImgDownloadPipeline(BaseImagesPipeline):
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)