diff --git a/av98.py b/av98.py index e30a9802..a9e27de5 100755 --- a/av98.py +++ b/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