From 7de8ed197267a74e97f7c402338862f50db8f963 Mon Sep 17 00:00:00 2001 From: cwx Date: Thu, 5 Oct 2023 05:12:10 +0800 Subject: [PATCH] fix --- Comics/utils/ComicUtils.py | 7 +++++-- Comics/utils/Constant.py | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Comics/utils/ComicUtils.py b/Comics/utils/ComicUtils.py index a6abc7f..2e4ebec 100644 --- a/Comics/utils/ComicUtils.py +++ b/Comics/utils/ComicUtils.py @@ -14,15 +14,18 @@ class checkUtils: # 检测某一章节是否连续错误 def export_error(self, item): if not self.is_error(item): + file = os.path.join(OUTPUT_DIR, item[PROJECT_KEY][0], "error_comics.json") error_comic = self.read(item) - error_comic.append({ "name" : item['name'], "chapter" : item['chapter'], "date" : ComicPath().getYearMonthDay()}) + error_comic.append({ "name" : ComicPath.new_file_name(item['name']), + "chapter" : ComicPath.new_file_name(item['chapter']), + "date" : ComicPath().getYearMonthDay()}) fu.save_file(file, json.dumps(error_comic)) def is_error(self, item): try: for error_c in eval(self.read(item)): (name, chatper, date) = [error_c['name'], error_c['chapter'], error_c['date']] - if item['name'] == name and item['chapter'] == chatper: + if ComicPath.new_file_name(item['name']) == ComicPath.new_file_name(name) and ComicPath.new_file_name(item['chapter']) == ComicPath.new_file_name(chatper): return True else: return False diff --git a/Comics/utils/Constant.py b/Comics/utils/Constant.py index 5ec5fac..dea6f59 100644 --- a/Comics/utils/Constant.py +++ b/Comics/utils/Constant.py @@ -55,6 +55,9 @@ class ComicPath: break return filename + @classmethod + def new_file_name(cls, name): return cls.fix_file_name(cls.chinese_convert(name)) + @classmethod def get_file_path(cls, item, result_type="image", file=None, convert=False): PROJECT = item[settings.PROJECT_KEY][0]