Commit d871dcde authored by setop's avatar setop 🚀
Browse files

do not override local file when downloading

parent 8612f51d
......@@ -57,6 +57,7 @@ def download(url):
ws = create_connection(url)
p = 0
t = 1
f = None
progress = tqdm()
while p < t:
ws.send('{"part":%d}' % p)
......@@ -66,7 +67,8 @@ def download(url):
data = loads(loads(result[idx+len(MAGIC):])) # second loads is unnecessary be kept for compatibility
t = meta["total"]
progress.total = t
f = open(meta["name"].split("/")[-1], "ab")
if not f:
f = open(meta["name"].split("/")[-1], "xb")
f.write(b64decode(SJCL().decrypt(data, key))) # b64 is unnecessary be kept for compatibility
progress.update()
p += 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment