Provider progress animation when downloading files > 100 KiB.
This commit is contained in:
parent
f78b6ff780
commit
50c43c75b4
16
av98.py
16
av98.py
@ -645,8 +645,22 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
|
||||
return status, meta, address, f
|
||||
|
||||
def _write_response_to_file(self, mime, mime_options, f, destination):
|
||||
spinner_seq = ["|", "/", "-", "\\"]
|
||||
# Read the response body over the network
|
||||
body = f.read()
|
||||
body = bytearray([])
|
||||
chunk_count = 0
|
||||
while True:
|
||||
chunk = f.read(100*1024)
|
||||
chunk_count += 1
|
||||
if not chunk:
|
||||
break
|
||||
body.extend(chunk)
|
||||
if chunk_count > 1:
|
||||
spinner = spinner_seq[chunk_count % 4]
|
||||
if chunk_count < 10:
|
||||
print("{} Received {} KiB...".format(spinner, chunk_count*100), end="\r")
|
||||
else:
|
||||
print("{} Received {} MiB...".format(spinner, chunk_count/10.0), end="\r")
|
||||
|
||||
# Save the result to a temporary file
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user