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