mirror of
https://github.com/ComradCollective/Comrad
synced 2024-11-01 21:40:32 +00:00
fixes
This commit is contained in:
parent
c5de80a476
commit
84bc7ef7c8
@ -11,7 +11,7 @@ import os,time,threading
|
||||
from threading import Thread
|
||||
from kivymd.uix.dialog import MDDialog
|
||||
from kivy.core.image import Image as CoreImage
|
||||
import io,shutil
|
||||
import io,shutil,asyncio
|
||||
from main import rgb,COLOR_TEXT
|
||||
|
||||
class ProgressPopup(MDDialog): pass
|
||||
@ -157,7 +157,7 @@ class PostScreen(ProtectedScreen):
|
||||
# upload
|
||||
#def do_upload():
|
||||
|
||||
self.app.upload(tmp_img_fn, file_id=file_id)
|
||||
asyncio.create_task(self.app.upload(tmp_img_fn, file_id=file_id))
|
||||
|
||||
# Thread(target=do_upload).start()
|
||||
|
||||
|
10
p2p/api.py
10
p2p/api.py
@ -301,7 +301,7 @@ class Api(object):
|
||||
|
||||
async def get_json(self,key_or_keys):
|
||||
res = await self.get(key_or_keys)
|
||||
# self.log('GET_JSON',res)
|
||||
self.log('get_json() got',res)
|
||||
if res is None: return res
|
||||
|
||||
def jsonize(entry):
|
||||
@ -477,7 +477,7 @@ class Api(object):
|
||||
parts=[]
|
||||
PARTS=[]
|
||||
buffer_size=100
|
||||
for part in bytes_from_file(filename,chunksize=1024*7):
|
||||
for part in bytes_from_file(filename,chunksize=1024*4):
|
||||
part_id = get_random_id()
|
||||
part_ids.append(part_id)
|
||||
part_key='/part/'+part_id
|
||||
@ -498,7 +498,8 @@ class Api(object):
|
||||
# set all parts
|
||||
#self.set(part_keys,PARTS)
|
||||
self.log('# parts:',len(PARTS))
|
||||
if parts and part_keys: await self.set(part_keys, parts)
|
||||
if parts and part_keys:
|
||||
await self.set(part_keys, parts)
|
||||
|
||||
# how many parts?
|
||||
self.log('# pieces!',len(part_ids))
|
||||
@ -512,7 +513,9 @@ class Api(object):
|
||||
return file_store
|
||||
|
||||
async def download(self,file_id):
|
||||
self.log('file_id =',file_id)
|
||||
file_store = await self.get_val('/file/'+file_id)
|
||||
self.log('file_store =',file_store)
|
||||
if file_store is None: return
|
||||
|
||||
self.log('file_store!?',file_store)
|
||||
@ -540,6 +543,7 @@ class Api(object):
|
||||
|
||||
async def get_val(self,uri):
|
||||
res=await self.get_json(uri)
|
||||
self.log('get_val() got',res)
|
||||
if res is None:
|
||||
return res
|
||||
elif type(res) == dict:
|
||||
|
Loading…
Reference in New Issue
Block a user