info debug
This commit is contained in:
parent
c9069f5b1e
commit
85a24e8cc7
@ -277,7 +277,7 @@ class ComicInfoXml:
|
|||||||
if not os.path.exists(base_dir): os.makedirs(base_dir)
|
if not os.path.exists(base_dir): os.makedirs(base_dir)
|
||||||
with open(filename, "w", encoding="utf-8") as file:
|
with open(filename, "w", encoding="utf-8") as file:
|
||||||
file.write(xml_string)
|
file.write(xml_string)
|
||||||
logger.info(f"ComicInfo.xml 生成成功 {filename}")
|
logger.debug(f"ComicInfo.xml 生成成功 {filename}")
|
||||||
|
|
||||||
def _validate_xml_with_xsd_file(self, xml_file, xsd_file, remove=True):
|
def _validate_xml_with_xsd_file(self, xml_file, xsd_file, remove=True):
|
||||||
"""
|
"""
|
||||||
@ -288,7 +288,7 @@ class ComicInfoXml:
|
|||||||
xsd_doc = etree.XMLSchema(etree.parse(file))
|
xsd_doc = etree.XMLSchema(etree.parse(file))
|
||||||
try:
|
try:
|
||||||
xsd_doc.assertValid(xml_doc)
|
xsd_doc.assertValid(xml_doc)
|
||||||
logger.info(f"ComicInfo.xml 通过 XSD 验证成功 {xml_file}")
|
logger.debug(f"ComicInfo.xml 通过 XSD 验证成功 {xml_file}")
|
||||||
except etree.DocumentInvalid as e:
|
except etree.DocumentInvalid as e:
|
||||||
logger.error(f"ComicInfo.xml 通过 XSD 验证失败 {xml_file}")
|
logger.error(f"ComicInfo.xml 通过 XSD 验证失败 {xml_file}")
|
||||||
if remove:
|
if remove:
|
||||||
@ -306,7 +306,7 @@ class ComicInfoXml:
|
|||||||
match = re.search(r"<PageCount>(\d+)</PageCount>", file_string)
|
match = re.search(r"<PageCount>(\d+)</PageCount>", file_string)
|
||||||
if match:
|
if match:
|
||||||
page_count = match.group(1)
|
page_count = match.group(1)
|
||||||
logger.info(f"zip_file={zip_file} PageCount: {page_count}")
|
logger.debug(f"zip_file={zip_file} PageCount: {page_count}")
|
||||||
return page_count
|
return page_count
|
||||||
|
|
||||||
def _parse_comicinfo(self, comic: ComicInfo, save_dir=None, xml_filename="ComicInfo.xml", xsd_filename="ComicInfo.xsd"):
|
def _parse_comicinfo(self, comic: ComicInfo, save_dir=None, xml_filename="ComicInfo.xml", xsd_filename="ComicInfo.xsd"):
|
||||||
|
|||||||
@ -121,7 +121,7 @@ class MangaDownloader:
|
|||||||
os.remove(save_path)
|
os.remove(save_path)
|
||||||
else:
|
else:
|
||||||
"""不更新刚返回"""
|
"""不更新刚返回"""
|
||||||
logger.info(f"{save_path} 已是更新")
|
logger.debug(f"{save_path} 已是更新")
|
||||||
return
|
return
|
||||||
async with aiohttp.ClientSession(headers=DEFAULT_HEADERS, timeout=aiohttp.ClientTimeout(total=TIMEOUT, connect=TIMEOUT)) as session:
|
async with aiohttp.ClientSession(headers=DEFAULT_HEADERS, timeout=aiohttp.ClientTimeout(total=TIMEOUT, connect=TIMEOUT)) as session:
|
||||||
await self.download_image(session,str(cover_item.url), save_path)
|
await self.download_image(session,str(cover_item.url), save_path)
|
||||||
@ -285,7 +285,7 @@ class CBZUtils:
|
|||||||
match = re.search(r"<PageCount>(\d+)</PageCount>", file_string)
|
match = re.search(r"<PageCount>(\d+)</PageCount>", file_string)
|
||||||
if match:
|
if match:
|
||||||
page_count = match.group(1)
|
page_count = match.group(1)
|
||||||
logger.info(f"zip_file={zip_file} PageCount: {page_count}")
|
logger.debug(f"zip_file={zip_file} PageCount: {page_count}")
|
||||||
return page_count
|
return page_count
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise exit(f"获取 ComicInfo.xml 文件中的 <PageCount> 标签值失败: {zip_file},错误: {str(e)}")
|
raise exit(f"获取 ComicInfo.xml 文件中的 <PageCount> 标签值失败: {zip_file},错误: {str(e)}")
|
||||||
@ -305,7 +305,7 @@ class CBZUtils:
|
|||||||
if is_comic_info:
|
if is_comic_info:
|
||||||
page_count = self._comic_info_xml_page_count(zip_file_path)
|
page_count = self._comic_info_xml_page_count(zip_file_path)
|
||||||
if len(file_list) == int(page_count) + 1:
|
if len(file_list) == int(page_count) + 1:
|
||||||
logger.info(f"ZIP 文件 {zip_file_path} 验证成功")
|
logger.debug(f"ZIP 文件 {zip_file_path} 验证成功")
|
||||||
result = True
|
result = True
|
||||||
else:
|
else:
|
||||||
logger.error(f"ZIP 文件 {zip_file_path} 验证失败,文件数量与 ComicInfo.xml 中的 <PageCount> 不一致")
|
logger.error(f"ZIP 文件 {zip_file_path} 验证失败,文件数量与 ComicInfo.xml 中的 <PageCount> 不一致")
|
||||||
@ -345,7 +345,7 @@ class CBZUtils:
|
|||||||
logger.debug("打包中:" + str(count) + "/" + str(len(filenames)), os.path.join(source_dir, file.name))
|
logger.debug("打包中:" + str(count) + "/" + str(len(filenames)), os.path.join(source_dir, file.name))
|
||||||
cbz.write(file, arcname=file.name)
|
cbz.write(file, arcname=file.name)
|
||||||
cbz.close()
|
cbz.close()
|
||||||
logger.info(f"打包完成:{target_file} 共 {count} 个文件")
|
logger.debug(f"打包完成:{target_file} 共 {count} 个文件")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"打包失败: {target_file},错误: {str(e)}")
|
logger.error(f"打包失败: {target_file},错误: {str(e)}")
|
||||||
if os.path.exists(target_file):
|
if os.path.exists(target_file):
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class BaseSite(ABC):
|
|||||||
# 尝试从缓存中获取 HTML 内容
|
# 尝试从缓存中获取 HTML 内容
|
||||||
cached_html = self.cache.get(url)
|
cached_html = self.cache.get(url)
|
||||||
if cached_html:
|
if cached_html:
|
||||||
logger.info(f"从缓存中获取 HTML 内容: {url}")
|
logger.debug(f"从缓存中获取 HTML 内容: {url}")
|
||||||
return cached_html
|
return cached_html
|
||||||
|
|
||||||
for attempt in range(retries):
|
for attempt in range(retries):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user