fix
This commit is contained in:
1 parent
c3de8413bf
commit
9ba828911e
2 files changed
+14
-2
No files matched your search
@@ -159,6 +159,7 @@ class ComicLoader(BaseLoader):
|
|||||||
def set_schapter(self, value): self.set_properties('s_chapter', value=value)
|
def set_schapter(self, value): self.set_properties('s_chapter', value=value)
|
||||||
def set_domain(self, value): self.set_properties('domain', value=value)
|
def set_domain(self, value): self.set_properties('domain', value=value)
|
||||||
def get_domain(self): return self.get_output_value("domain")
|
def get_domain(self): return self.get_output_value("domain")
|
||||||
|
def get_count(self): return self.get_output_value("count")
|
||||||
|
|
||||||
# 章节页码
|
# 章节页码
|
||||||
def count(self):
|
def count(self):
|
||||||
|
|||||||
+13
-2
@@ -7,6 +7,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,shutil
|
import os,scrapy,logging,shutil
|
||||||
from Comics import settings
|
from Comics import settings
|
||||||
|
from Comics.settings import IMAGES_STORE
|
||||||
from Comics._utils.items import ComicItem
|
from Comics._utils.items import ComicItem
|
||||||
from Comics._utils.loader import ComicLoader
|
from Comics._utils.loader import ComicLoader
|
||||||
from Comics._utils.utils import CBZUtils,fileUtils as fu
|
from Comics._utils.utils import CBZUtils,fileUtils as fu
|
||||||
@@ -90,7 +91,17 @@ class ImgDownloadPipeline(BaseImagesPipeline):
|
|||||||
if os.path.isfile(path) and dirname.startswith(name):
|
if os.path.isfile(path) and dirname.startswith(name):
|
||||||
fu.update_icon(path, cbz_icon)
|
fu.update_icon(path, cbz_icon)
|
||||||
|
|
||||||
|
def download_validate(self, item):
|
||||||
|
comic = ComicLoader(item=item)
|
||||||
|
# 获取需要解析下载的图像
|
||||||
|
images_item = comic.parse_images()
|
||||||
|
exist_images = []
|
||||||
|
for image_item in images_item:
|
||||||
|
image_path = os.path.join(IMAGES_STORE, image_item["image_path"])
|
||||||
|
if image_item["image_type"] == "Image" and os.path.exists(image_path): exist_images.append(image_path)
|
||||||
|
if len(comic.get_image_urls()) == len(exist_images) and len(exist_images) != 0 : return True
|
||||||
|
return False
|
||||||
|
|
||||||
def item_completed(self, results, item, info):
|
def item_completed(self, results, item, info):
|
||||||
"""图片下载完成,开始CBZ打包
|
"""图片下载完成,开始CBZ打包
|
||||||
不再做数据完整检验,CBZUtils后续会自动检验
|
不再做数据完整检验,CBZUtils后续会自动检验
|
||||||
@@ -101,7 +112,7 @@ class ImgDownloadPipeline(BaseImagesPipeline):
|
|||||||
info (_type_): 信息
|
info (_type_): 信息
|
||||||
"""
|
"""
|
||||||
# 存在未下载图像数据则重试
|
# 存在未下载图像数据则重试
|
||||||
if not super().success_completed(item, results): return
|
if not self.download_validate(item): return self.get_media_requests(item, info)
|
||||||
# super().update_icon(item)
|
# super().update_icon(item)
|
||||||
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)
|
||||||
|
|||||||
Reference in new issue
Block a user