Now the system work with big files
parent
397d911a5d
commit
911652fa2b
|
@ -13,6 +13,7 @@ from random import randint
|
|||
from shutil import rmtree
|
||||
from threading import Thread
|
||||
from time import sleep
|
||||
from uuid import uuid4
|
||||
|
||||
from PIL import Image, ImageTk
|
||||
from requests import post
|
||||
|
@ -182,8 +183,12 @@ class MunyalClient(Icon):
|
|||
directory = os.path.split(full_path)[0]
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory, exist_ok=True)
|
||||
with open(full_path, "wb") as f:
|
||||
directory, _ = os.path.split(full_path)
|
||||
temp_name = str(uuid4()) + ".tmp"
|
||||
temp_dir = path_join(directory, temp_name)
|
||||
with open(temp_dir, "wb") as f:
|
||||
f.write(base64.b85decode(data["file"].encode("ascii")))
|
||||
os.rename(temp_dir, full_path)
|
||||
else:
|
||||
os.remove(full_path)
|
||||
else:
|
||||
|
@ -192,7 +197,6 @@ class MunyalClient(Icon):
|
|||
else:
|
||||
shutil.rmtree(full_path)
|
||||
|
||||
|
||||
def __download(self, message):
|
||||
try:
|
||||
data = json.loads(message)
|
||||
|
|
BIN
img/logo.png
BIN
img/logo.png
Binary file not shown.
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 101 KiB |
Loading…
Reference in New Issue