|
@@ -347,7 +347,7 @@ async def swapFace(req:models.swap_req):
|
|
|
im = Image.open(requests.get(req.imgurl, stream=True).raw)
|
|
|
im= im.convert("RGB")
|
|
|
except:
|
|
|
- return {'msg':"無法辨別圖片網址"+req.imgurl}
|
|
|
+ return {'msg':{'eng':req.imgurl+'cant be proccessed','zh':"無法辨別圖片網址"+req.imgurl}}
|
|
|
name_hash = str(time.time()).replace('.','')
|
|
|
|
|
|
x = threading.Thread(target=gen_avatar, args=(name_hash,req.imgurl))
|
|
@@ -371,13 +371,13 @@ async def create_upload_file(file: UploadFile = File(...)):
|
|
|
return {"msg": resource_server+tmp_img_sub_folder+img_name+'.jpg'}
|
|
|
except Exception as e:
|
|
|
logging.error(traceback.format_exc())
|
|
|
- return {'msg':'檔案無法使用'}
|
|
|
+ return {'msg':{'eng':'file cant be prossessed','zh':'檔案無法使用'}}
|
|
|
|
|
|
@app.post("/upload_pttx/")
|
|
|
async def upload_pttx(file: UploadFile = File(...)):
|
|
|
try:
|
|
|
if "_" in file.filename:
|
|
|
- return {'msg':'檔案無法使用檔名不能含有"_"符號'}
|
|
|
+ return {'msg':{'eng':'symbol"_" is not allowed in file name','zh':'檔案無法使用檔名不能含有"_"符號'}}
|
|
|
else:
|
|
|
pttx_name = file.filename+'_'+str(time.time()).replace('.','')
|
|
|
with open(pttx_dest+pttx_name, "wb+") as file_object:
|
|
@@ -385,7 +385,7 @@ async def upload_pttx(file: UploadFile = File(...)):
|
|
|
return {"msg": resource_server+pttx_sub_folder+pttx_name}
|
|
|
except Exception as e:
|
|
|
logging.error(traceback.format_exc())
|
|
|
- return {'msg':'檔案無法使用'}
|
|
|
+ return {'msg':{'eng':'file cant be prossessed','zh':'檔案無法使用'}}
|
|
|
|
|
|
|
|
|
@app.post("/make_anchor_video_gSlide")
|
|
@@ -559,7 +559,7 @@ async def del_draft(id_obj:models.id_obj,token: str = Depends(oauth2_scheme)):
|
|
|
user_id = get_user_id(token)
|
|
|
statement = 'SELECT * FROM draft WHERE user_id="'+str(user_id)+'" and id ="'+str(id_obj.id)+'"'
|
|
|
if first(db.query(statement)) is not None:
|
|
|
- db['draft'].delete(id=id)
|
|
|
+ db['draft'].delete(id=id_obj.id)
|
|
|
else:
|
|
|
return {'msg':'wrong id'}
|
|
|
|
|
@@ -591,7 +591,7 @@ async def history_input(token: str = Depends(oauth2_scheme)):
|
|
|
|
|
|
logs = []
|
|
|
for row in db.query(statement):
|
|
|
- logs.append({'id':row['id'],'name':row['name'],'text_content':row['text_content'].split(','),'link':row['link'],'image_urls':row['image_urls'].split(',')})
|
|
|
+ logs.append({'id':row['id'],'name':row['name'],'avatar':row['avatar'],'text_content':row['text_content'].split(','),'link':row['link'],'image_urls':row['image_urls'].split(',')})
|
|
|
return logs
|
|
|
|
|
|
|
|
@@ -687,7 +687,7 @@ def save_history(req,name_hash,user_id):
|
|
|
time_stamp = datetime.fromtimestamp(time.time())
|
|
|
time_stamp = time_stamp.strftime("%Y-%m-%d %H:%M:%S")
|
|
|
pk = log_table.insert({'name':req.name,'text_content':txt_content_seperate_by_dot,'image_urls':img_urls_seperate_by_dot
|
|
|
- ,'user_id':user_id,'link':'www.choozmo.com:8168/'+video_sub_folder+name_hash+'.mp4','timestamp':time_stamp})
|
|
|
+ ,'user_id':user_id,'link':'www.choozmo.com:8168/'+video_sub_folder+name_hash+'.mp4','avatar':req.avatar,'timestamp':time_stamp})
|
|
|
return pk
|
|
|
|
|
|
def get_url_type(url):
|