mirror of
https://git.56k.es/fanta/chunkd.git
synced 2024-06-07 17:25:24 +02:00
quitada la barra de progreso
This commit is contained in:
parent
3371cffebb
commit
7ef6ce4c77
14
chunkd
14
chunkd
|
@ -5,9 +5,8 @@
|
||||||
import sys
|
import sys
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
import progressbar
|
|
||||||
|
|
||||||
chunkSize=1024*1024*1024
|
chunkSize=2048
|
||||||
errorMsg="Example: chunkd http://fanta.56k.es/games/1990/1990-King_Quest_5/King_Quest_5.tar.gz"
|
errorMsg="Example: chunkd http://fanta.56k.es/games/1990/1990-King_Quest_5/King_Quest_5.tar.gz"
|
||||||
if len(sys.argv) == 2: url=sys.argv[1]
|
if len(sys.argv) == 2: url=sys.argv[1]
|
||||||
else: print(errorMsg); exit(1)
|
else: print(errorMsg); exit(1)
|
||||||
|
@ -15,9 +14,6 @@ session = requests.Session()
|
||||||
try: response = session.get(url,allow_redirects=True,stream=True)
|
try: response = session.get(url,allow_redirects=True,stream=True)
|
||||||
except: print(errorMsg); exit(1)
|
except: print(errorMsg); exit(1)
|
||||||
fileLocalFilename = url.split('/')[-1]
|
fileLocalFilename = url.split('/')[-1]
|
||||||
contentLen=None
|
|
||||||
try: fileSize=int(response.headers['content-length'])
|
|
||||||
except: contentLen="false"
|
|
||||||
print("\n[+] "+fileLocalFilename+" - chunk Size: ",chunkSize)
|
print("\n[+] "+fileLocalFilename+" - chunk Size: ",chunkSize)
|
||||||
|
|
||||||
def downloadChunks():
|
def downloadChunks():
|
||||||
|
@ -27,15 +23,9 @@ def downloadChunks():
|
||||||
if chunk:
|
if chunk:
|
||||||
totalbits += len(chunk)
|
totalbits += len(chunk)
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
bar.update(totalbits)
|
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
with open(fileLocalFilename, 'wb') as f:
|
with open(fileLocalFilename, 'wb') as f:
|
||||||
if contentLen == "false":
|
downloadChunks()
|
||||||
with progressbar.ProgressBar(max_value=progressbar.UnknownLength) as bar:
|
|
||||||
downloadChunks()
|
|
||||||
else:
|
|
||||||
with progressbar.ProgressBar(max_value=fileSize) as bar:
|
|
||||||
downloadChunks()
|
|
||||||
|
|
||||||
print("\n")
|
print("\n")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user