diff --git a/Pipfile b/Pipfile index 0742e01..07f6b99 100644 --- a/Pipfile +++ b/Pipfile @@ -8,6 +8,7 @@ multiping = "*" pillow = "*" websockets = "*" python-dotenv = "*" +progressbar2 = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index d714720..2ce5f39 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "ccef10c99ccde2850597144b704849fcf19f79b971452ec2852a364ff77499f7" + "sha256": "ca70896409e8bb458353718d1d9d4dbca1c65365fb9e11a122532b908082895a" }, "pipfile-spec": 6, "requires": { @@ -109,6 +109,14 @@ "index": "pypi", "version": "==9.4.0" }, + "progressbar2": { + "hashes": [ + "sha256:1393922fcb64598944ad457569fbeb4b3ac189ef50b5adb9cef3284e87e394ce", + "sha256:1a8e201211f99a85df55f720b3b6da7fb5c8cdef56792c4547205be2de5ea606" + ], + "index": "pypi", + "version": "==4.2.0" + }, "python-dotenv": { "hashes": [ "sha256:a8df96034aae6d2d50a4ebe8216326c61c3eb64836776504fcca410e5937a3ba", @@ -117,6 +125,14 @@ "index": "pypi", "version": "==1.0.0" }, + "python-utils": { + "hashes": [ + "sha256:68198854fc276bc4b2403b261703c218e01ef564dcb072a7096ed9ea7aa5130c", + "sha256:8bfefc3430f1c48408fa0e5958eee51d39840a5a987c2181a579e99ab6fe5ca6" + ], + "markers": "python_version >= '3.7'", + "version": "==3.5.2" + }, "websockets": { "hashes": [ "sha256:00213676a2e46b6ebf6045bc11d0f529d9120baa6f58d122b4021ad92adabd41", diff --git a/network.py b/network.py index 79703d2..3b13e3f 100644 --- a/network.py +++ b/network.py @@ -1,7 +1,7 @@ from typing import Generator, Any, List, Tuple from multiping import multi_ping - +from progressbar import progressbar from pixel_types import Pixel # The largest possible chunk that can be given to Multiping @@ -43,7 +43,7 @@ def upload(ips: List[str], chunk_size: int = None): # Default to maximum chunk size if chunk_size is None: chunk_size = maximum_chunk + # random.shuffle(ips) chunked = list(chunkify(ips, min(maximum_chunk, chunk_size))) - for i, chunk in enumerate(chunked, start=1): - print(f'Chunk {i}/{len(chunked)}') - multi_ping(chunk, timeout=0.2, retry=0) + for i, chunk in progressbar(list(enumerate(chunked, start=1))): + multi_ping(chunk, timeout=0.1, retry=0)