This commit is contained in:
caiwx86 2025-02-04 21:30:55 +08:00
parent c8511da2e7
commit 0000f3df38

View File

@ -173,7 +173,8 @@ class MangaManager:
try: try:
total_chapters = 0 total_chapters = 0
completed_chapters = 0 completed_chapters = 0
success_chapters = 0
async for result in manager.process_manga(url, status_callback=cls.print_progress): async for result in manager.process_manga(url, status_callback=cls.print_progress):
if result['type'] == 'progress': if result['type'] == 'progress':
total_chapters = result['total_chapters'] total_chapters = result['total_chapters']
@ -190,6 +191,7 @@ class MangaManager:
f"{chapter_result['failed']} 张失败" f"{chapter_result['failed']} 张失败"
) )
else: else:
success_chapters += 1
logger.info(f"章节 {result['chapter']} 完成") logger.info(f"章节 {result['chapter']} 完成")
print(f"\n总进度: {completed_chapters}/{total_chapters}") print(f"\n总进度: {completed_chapters}/{total_chapters}")
@ -201,7 +203,7 @@ class MangaManager:
logger.error(f"下载出错: {result['error']}") logger.error(f"下载出错: {result['error']}")
# 全部下载完成 # 全部下载完成
if int(total_chapters) == int(completed_chapters): if int(total_chapters) == int(success_chapters):
MangaUtils().add_manga(title, created_at=created_at) MangaUtils().add_manga(title, created_at=created_at)
logger.info(f"全部完成 {title}, {created_at}") logger.info(f"全部完成 {title}, {created_at}")
except MangaException as e: except MangaException as e: