mirror of
https://github.com/Xevion/v6-place.git
synced 2025-12-05 23:16:48 -06:00
Use progressbar2 for chunk upload process
This commit is contained in:
1
Pipfile
1
Pipfile
@@ -8,6 +8,7 @@ multiping = "*"
|
|||||||
pillow = "*"
|
pillow = "*"
|
||||||
websockets = "*"
|
websockets = "*"
|
||||||
python-dotenv = "*"
|
python-dotenv = "*"
|
||||||
|
progressbar2 = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
|
|
||||||
|
|||||||
18
Pipfile.lock
generated
18
Pipfile.lock
generated
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "ccef10c99ccde2850597144b704849fcf19f79b971452ec2852a364ff77499f7"
|
"sha256": "ca70896409e8bb458353718d1d9d4dbca1c65365fb9e11a122532b908082895a"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -109,6 +109,14 @@
|
|||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==9.4.0"
|
"version": "==9.4.0"
|
||||||
},
|
},
|
||||||
|
"progressbar2": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:1393922fcb64598944ad457569fbeb4b3ac189ef50b5adb9cef3284e87e394ce",
|
||||||
|
"sha256:1a8e201211f99a85df55f720b3b6da7fb5c8cdef56792c4547205be2de5ea606"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==4.2.0"
|
||||||
|
},
|
||||||
"python-dotenv": {
|
"python-dotenv": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:a8df96034aae6d2d50a4ebe8216326c61c3eb64836776504fcca410e5937a3ba",
|
"sha256:a8df96034aae6d2d50a4ebe8216326c61c3eb64836776504fcca410e5937a3ba",
|
||||||
@@ -117,6 +125,14 @@
|
|||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==1.0.0"
|
"version": "==1.0.0"
|
||||||
},
|
},
|
||||||
|
"python-utils": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:68198854fc276bc4b2403b261703c218e01ef564dcb072a7096ed9ea7aa5130c",
|
||||||
|
"sha256:8bfefc3430f1c48408fa0e5958eee51d39840a5a987c2181a579e99ab6fe5ca6"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '3.7'",
|
||||||
|
"version": "==3.5.2"
|
||||||
|
},
|
||||||
"websockets": {
|
"websockets": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:00213676a2e46b6ebf6045bc11d0f529d9120baa6f58d122b4021ad92adabd41",
|
"sha256:00213676a2e46b6ebf6045bc11d0f529d9120baa6f58d122b4021ad92adabd41",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from typing import Generator, Any, List, Tuple
|
from typing import Generator, Any, List, Tuple
|
||||||
|
|
||||||
from multiping import multi_ping
|
from multiping import multi_ping
|
||||||
|
from progressbar import progressbar
|
||||||
from pixel_types import Pixel
|
from pixel_types import Pixel
|
||||||
|
|
||||||
# The largest possible chunk that can be given to Multiping
|
# 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
|
# Default to maximum chunk size
|
||||||
if chunk_size is None: chunk_size = maximum_chunk
|
if chunk_size is None: chunk_size = maximum_chunk
|
||||||
|
|
||||||
|
# random.shuffle(ips)
|
||||||
chunked = list(chunkify(ips, min(maximum_chunk, chunk_size)))
|
chunked = list(chunkify(ips, min(maximum_chunk, chunk_size)))
|
||||||
for i, chunk in enumerate(chunked, start=1):
|
for i, chunk in progressbar(list(enumerate(chunked, start=1))):
|
||||||
print(f'Chunk {i}/{len(chunked)}')
|
multi_ping(chunk, timeout=0.1, retry=0)
|
||||||
multi_ping(chunk, timeout=0.2, retry=0)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user