Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions baidupcs_py/baidupcs/pcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from pathlib import Path
from urllib.parse import urlparse, quote_plus

from urllib.error import HTTPError
from base64 import standard_b64encode
import re
Expand Down
29 changes: 17 additions & 12 deletions baidupcs_py/commands/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,23 @@ def except_callback(task_id: Optional[TaskID]):
encrypt_password=encrypt_password,
)

if task_id is not None:
length = len(meDownloader)
_progress.update(task_id, total=length)
_progress.start_task(task_id)

meDownloader.download(
Path(localpath),
task_id=task_id,
continue_=True,
done_callback=_wrap_done_callback,
except_callback=except_callback,
)
try:
if task_id is not None:
length = len(meDownloader)
_progress.update(task_id, total=length)
_progress.start_task(task_id)

meDownloader.download(
Path(localpath),
task_id=task_id,
continue_=True,
done_callback=_wrap_done_callback,
except_callback=except_callback,
)
except IOError:
# catch 104 connection reset issue 59
_progress.remove_task(task_id)
_progress.stop()

def _aget_py_cmd(
self,
Expand Down