diff --git a/persepolis_lib/persepolis_lib.py b/persepolis_lib/persepolis_lib.py index d0568da..b6c99b2 100644 --- a/persepolis_lib/persepolis_lib.py +++ b/persepolis_lib/persepolis_lib.py @@ -23,8 +23,6 @@ from persepolis_lib.useful_tools import convertTime, humanReadableSize, convertSize, sendToLog, convertHeaderToDictionary, readCookieJar, getFileNameFromLink import sys import json -from urllib.parse import urlparse, unquote -from pathlib import Path from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry @@ -603,7 +601,7 @@ def threadHandler(self, thread_number): * self.python_request_chunk_size) for data in response.iter_content( chunk_size=python_request_chunk_size): - if self.download_status == 'downloading': + if self.download_status == 'downloading' or self.download_status == 'paused': fp.write(data) # maybe the last chunk is less than default chunk size @@ -652,10 +650,10 @@ def threadHandler(self, thread_number): # receiving loop, which reduces the download speed. time.sleep(self.sleep_for_speed_limiting) - elif self.download_status == 'paused': - # wait for unpausing - while self.download_status == 'paused': - time.sleep(0.2) + if self.download_status == 'paused': + # wait for unpausing + while self.download_status == 'paused': + time.sleep(0.2) else: self.download_infromation_list[part_number][2] = 'stopped' break