fix
This commit is contained in:
parent
4ca07366e6
commit
78d19e1e51
@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
# useful for handling different item types with a single interface
|
||||
import os,scrapy,logging
|
||||
import os,scrapy,logging,shutil
|
||||
from Comics import settings
|
||||
from Comics.items import ComicItem
|
||||
from Comics.loader import ComicLoader
|
||||
@ -115,18 +115,23 @@ class ImgDownloadPipeline(BaseImagesPipeline):
|
||||
|
||||
def item_completed(self, results, item, info):
|
||||
"""图片下载完成,开始CBZ打包
|
||||
|
||||
不再做数据完整检验,CBZUtils后续会自动检验
|
||||
传入图像路径即可
|
||||
Args:
|
||||
results (_type_): 当前下载完成的图片,已下载的已忽略
|
||||
item (_type_): Comic item数据
|
||||
info (_type_): 信息
|
||||
"""
|
||||
cbz_path = super().get_file_path(item, result_type="cbz")
|
||||
# chapter_dir = ComicPath(item=item).file_path(result_type=ComicPath().MAPPING_IMAGES_DIR)
|
||||
chapter_dir = ComicPath(item=item).file_path(result_type=ComicPath().MAPPING_IMAGES_DIR)
|
||||
# images_file = oldUtils().old_images(folder=chapter_dir)
|
||||
# if len(images_file) != len(ComicLoader(item=item).get_image_urls()): return
|
||||
if fu.exists(cbz_path):
|
||||
#self.update_icon(item)
|
||||
chapter = os.path.basename(cbz_path).split(".")[0]
|
||||
if os.path.exists(chapter_dir) and chapter in chapter_dir:
|
||||
print(f"正在删除多余章节文件夹 {chapter_dir}")
|
||||
shutil.rmtree(chapter_dir)
|
||||
self.pack_icon(item)
|
||||
else:
|
||||
# ComicInfoXml 生成
|
||||
@ -141,8 +146,8 @@ class ImgDownloadPipeline(BaseImagesPipeline):
|
||||
super().update_icon(item)
|
||||
self.pack_icon(item)
|
||||
# CBZ校验失败
|
||||
else:
|
||||
checkUtils().export_error(item)
|
||||
#else:
|
||||
# checkUtils().export_error(item)
|
||||
#sleep_time = random.randint(3,15)
|
||||
#print(f'等待{sleep_time}秒后进行下一章节')
|
||||
#time.sleep(int(sleep_time))
|
||||
Loading…
Reference in New Issue
Block a user