Compare commits
2 Commits
Transphase
...
Transphase
| Author | SHA1 | Date | |
|---|---|---|---|
| 00bf69ed34 | |||
| 7562395529 |
@@ -147,7 +147,7 @@ async def main():
|
||||
message = json.loads(message)
|
||||
if message["msgtype"] == "announce" and message["peer_group_id"] == peer_group_id:
|
||||
break
|
||||
bar = Bar('Transferring', max=number_of_chunks, suffix='%(percent).1f%% complete - %(eta_td)s remaining')
|
||||
bar = Bar('Transferring', max=number_of_chunks, check_tty=False, suffix='%(percent).1f%% complete - %(eta_td)s remaining')
|
||||
msgtype = "data"
|
||||
async for chunk in read_chunks(file_path, chunk_size):
|
||||
msg = (msgtype, peer_group_id, role, filename, chunk_size, chunk_id, number_of_chunks, chunk)
|
||||
@@ -175,7 +175,7 @@ async def main():
|
||||
chunk_id = msg["chunk_id"]
|
||||
number_of_chunks = msg["number_of_chunks"]
|
||||
if bar is None:
|
||||
bar = Bar('Receiving', max=number_of_chunks, suffix='%(percent).1f%% complete - %(eta_td)s remaining')
|
||||
bar = Bar('Receiving', max=number_of_chunks, check_tty=False, suffix='%(percent).1f%% complete - %(eta_td)s remaining')
|
||||
if f is None:
|
||||
f = open(msg["filename"], "wb")
|
||||
f.write(msg["chunk"])
|
||||
@@ -188,11 +188,10 @@ async def main():
|
||||
|
||||
if chunk_id >= number_of_chunks-1:
|
||||
# This is the last chunk, exit
|
||||
bar.index = 100
|
||||
f.close()
|
||||
bar.suffix = '%(percent).1f%% complete'
|
||||
bar.update()
|
||||
f.close()
|
||||
print("")
|
||||
bar.finish()
|
||||
break
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user