Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions biliarchiver/cli_tools/bili_archive_bvids.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ def check_free_space():
d.progress.start()
sem = asyncio.Semaphore(config.video_concurrency)
tasks: List[asyncio.Task] = []
failed_tasks: list[tuple[asyncio.Task, BaseException]] = []

def tasks_check():
failed_tasks = []
for task in tasks:
if task.done():
_task_exception = task.exception()
Expand All @@ -131,9 +131,6 @@ def tasks_check():
task.cancel()
raise RuntimeError(s)

if failed_tasks:
print(f"完成所有任务,但有 {len(failed_tasks)} 个任务失败")
raise failed_tasks[0][1]

for index, bvid in enumerate(bvids_list):
if index < skip_to:
Expand Down Expand Up @@ -171,7 +168,11 @@ def tasks_check():
await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
tasks_check()

print("DONE")
d.progress.stop()
if failed_tasks:
print(_("完成所有任务,但有 {} 个任务失败").format(len(failed_tasks)))
else:
print(_("完成所有任务"))


def update_cookies_from_browser(client: AsyncClient, browser: str):
Expand Down
Loading