|
@@ -117,6 +117,19 @@ async def progress_page():
|
|
|
|
|
|
@app.post("/make_anchor_video_v2")
|
|
|
async def make_anchor_video_v2(req:request2):
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
+ log_table = db['history_input']
|
|
|
+ txt_content_seperate_by_dot = ''
|
|
|
+ for txt in req.text_content:
|
|
|
+ txt_content_seperate_by_dot += txt+","
|
|
|
+ txt_content_seperate_by_dot = txt_content_seperate_by_dot[:-1]
|
|
|
+ img_urls_seperate_by_dot = ''
|
|
|
+ for iurl in req.image_urls:
|
|
|
+ img_urls_seperate_by_dot += iurl+","
|
|
|
+ img_urls_seperate_by_dot = img_urls_seperate_by_dot[:-1]
|
|
|
+ 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,'timestamp':time_stamp})
|
|
|
x = threading.Thread(target=anchor_video_v2, args=(req.name, req.text_content, req.image_urls))
|
|
|
x.start()
|
|
|
return {"msg":"製作影片需要時間,請您耐心等候 稍後可以在www.choozmo.com:8168/"+req.name+".mp4 中觀看"}
|
|
@@ -140,23 +153,6 @@ async def history_input():
|
|
|
logs.append({'id':row['id'],'name':row['name'],'text_content':row['text_content'].split(','),'image_urls':row['image_urls'].split(',')})
|
|
|
return logs
|
|
|
|
|
|
-@app.post("/log_test")
|
|
|
-async def log_test(req:request2):
|
|
|
- db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
- log_table = db['history_input']
|
|
|
- txt_content_seperate_by_dot = ''
|
|
|
- for txt in req.text_content:
|
|
|
- txt_content_seperate_by_dot += txt+","
|
|
|
- txt_content_seperate_by_dot = txt_content_seperate_by_dot[:-1]
|
|
|
- img_urls_seperate_by_dot = ''
|
|
|
- for iurl in req.image_urls:
|
|
|
- img_urls_seperate_by_dot += iurl+","
|
|
|
- img_urls_seperate_by_dot = img_urls_seperate_by_dot[:-1]
|
|
|
- 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,'timestamp':time_stamp})
|
|
|
- return pk
|
|
|
-
|
|
|
def notify_group(msg):
|
|
|
headers = {
|
|
|
"Authorization": "Bearer " + "WekCRfnAirSiSxALiD6gcm0B56EejsoK89zFbIaiZQD",
|