This commit is contained in:
cwx committed 2024-03-31 17:02:46 +08:00
1 parent 55064d642b
commit 8c91984599
2 files changed
+24 -24

No files matched your search

+3 -3
View File
@@ -35,11 +35,11 @@ class RmComicSpider(scrapy.Spider):
# 打包导出item数据 # 打包导出item数据
item = comic_item.load_item(chapter=chapter) item = comic_item.load_item(chapter=chapter)
# 获取最终存放CBZ的路径 # 获取最终存放CBZ的路径
cbz_path = ComicPath(item=item).file_path(ComicPath.PATH_CBZ, convert=True, chapter=chapter) #cbz_path = ComicPath(item=item).file_path(ComicPath.PATH_CBZ, convert=True, chapter=chapter)
#cbz_path = ComicPath(item=item).PATH_CBZ() cbz_path = ComicPath(item=item).PATH_CBZ()
# 校验繁体和简体中文CBZ路径是否存在 # 校验繁体和简体中文CBZ路径是否存在
# if not checkUtils().is_error(item) and os.path.exists(cbz_path): # if not checkUtils().is_error(item) and os.path.exists(cbz_path):
if os.path.exists(cbz_path): if cbz_path !=None and os.path.exists(cbz_path):
logging.info(f"漫画 {cbz_path} 已存在, 跳过中...") logging.info(f"漫画 {cbz_path} 已存在, 跳过中...")
yield item yield item
else: else:
+21 -21
View File
@@ -616,36 +616,36 @@ class ComicPath:
PREFIX_SCRAMBLE = "scramble=" PREFIX_SCRAMBLE = "scramble="
PATH_IMAGE = "image" MAPPING_IMAGE = "image"
PATH_COMIC_INFO = "comic_info" MAPPING_COMIC_INFO = "comic_info"
PATH_CBZ_ICON = "cbz_icon" MAPPING_CBZ_ICON = "cbz_icon"
PATH_DOWN_ICON = "down_icon" MAPPING_DOWN_ICON = "down_icon"
PATH_DOWN_CACHE_ICON = "down_cache_icon" MAPPING_DOWN_CACHE_ICON = "down_cache_icon"
PATH_ICON = "icon" MAPPING_ICON = "icon"
PATH_ICON_CACHE = "icon_cache" MAPPING_ICON_CACHE = "icon_cache"
PATH_CBZ = "cbz" MAPPING_CBZ = "cbz"
PATH_IMAGES_DIR = "images_dir" MAPPING_IMAGES_DIR = "images_dir"
def PATH_MAPPING(self): def PATH_MAPPING(self):
if self.project == None or self.name == None or self.chapter == None: return None if self.project == None or self.name == None or self.chapter == None: return None
return { return {
self.PATH_IMAGE: os.path.join(self.project, "images", self.name, self.chapter), self.MAPPING_IMAGE: os.path.join(self.project, "images", self.name, self.chapter),
self.PATH_COMIC_INFO: os.path.join(self.project, "images", self.name, self.chapter), self.MAPPING_COMIC_INFO: os.path.join(self.project, "images", self.name, self.chapter),
self.PATH_CBZ_ICON: os.path.join(settings.CBZ_EXPORT_PATH, self.project, self.name, self.chapter+".jpg"), self.MAPPING_CBZ_ICON: os.path.join(settings.CBZ_EXPORT_PATH, self.project, self.name, self.chapter+".jpg"),
self.PATH_DOWN_ICON: os.path.join(settings.IMAGES_STORE, self.project, "icons", self.name, self.name+".jpg"), self.MAPPING_DOWN_ICON: os.path.join(settings.IMAGES_STORE, self.project, "icons", self.name, self.name+".jpg"),
self.PATH_DOWN_CACHE_ICON: os.path.join(settings.IMAGES_STORE, self.project, "icons", ".cache", self.name+".jpg"), self.MAPPING_DOWN_CACHE_ICON: os.path.join(settings.IMAGES_STORE, self.project, "icons", ".cache", self.name+".jpg"),
self.PATH_ICON: os.path.join(self.project, "icons", self.name, self.name+".jpg"), self.MAPPING_ICON: os.path.join(self.project, "icons", self.name, self.name+".jpg"),
self.PATH_ICON_CACHE: os.path.join(self.project, "icons", ".cache", self.name+".jpg"), self.MAPPING_ICON_CACHE: os.path.join(self.project, "icons", ".cache", self.name+".jpg"),
self.PATH_CBZ: os.path.join(settings.CBZ_EXPORT_PATH, self.project, self.name, self.chapter+".CBZ"), self.MAPPING_CBZ: os.path.join(settings.CBZ_EXPORT_PATH, self.project, self.name, self.chapter+".CBZ"),
self.PATH_IMAGES_DIR: os.path.join(settings.IMAGES_STORE, self.project, "images", self.name, self.chapter) self.MAPPING_IMAGES_DIR: os.path.join(settings.IMAGES_STORE, self.project, "images", self.name, self.chapter)
} }
def PATH_CBZ(self, result_type=PATH_CBZ): self.file_path(result_type=result_type) def PATH_CBZ(self, result_type=MAPPING_CBZ): return self.file_path(result_type=result_type)
def file_path(self, result_type=PATH_IMAGE, file=None, convert=True, chapter=None): def file_path(self, result_type=MAPPING_IMAGE, file=None, convert=True, chapter=None):
if chapter != None: self.chapter = chapter if chapter != None: self.chapter = chapter
path = self.PATH_MAPPING().get(result_type, None) path = self.PATH_MAPPING().get(result_type, None)
if result_type == self.PATH_IMAGE and os.path.sep not in file: if result_type == self.MAPPING_IMAGE and os.path.sep not in file:
return os.path.join(path, file) return os.path.join(path, file)
if convert: if convert:
path = self.chinese_convert(path) path = self.chinese_convert(path)