|
@@ -59,6 +59,7 @@ class request(BaseModel):
|
|
name: str
|
|
name: str
|
|
text_content: List[str]
|
|
text_content: List[str]
|
|
image_urls: List[str]
|
|
image_urls: List[str]
|
|
|
|
+ avatar: str
|
|
|
|
|
|
|
|
|
|
class ConnectionManager:
|
|
class ConnectionManager:
|
|
@@ -123,8 +124,7 @@ async def make_anchor_video_v2(req:request):
|
|
time_stamp = datetime.fromtimestamp(time.time())
|
|
time_stamp = datetime.fromtimestamp(time.time())
|
|
time_stamp = time_stamp.strftime("%Y-%m-%d %H:%M:%S")
|
|
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})
|
|
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,int(req.avatar)))
|
|
|
|
- x = threading.Thread(target=anchor_video_v2, args=(req.name, req.text_content, req.image_urls))
|
|
|
|
|
|
+ x = threading.Thread(target=anchor_video_v2, args=(req.name, req.text_content, req.image_urls,int(req.avatar)))
|
|
x.start()
|
|
x.start()
|
|
return {"msg":"製作影片需要時間,請您耐心等候 稍後可以在www.choozmo.com:8168/"+req.name+".mp4 中觀看"}
|
|
return {"msg":"製作影片需要時間,請您耐心等候 稍後可以在www.choozmo.com:8168/"+req.name+".mp4 中觀看"}
|
|
|
|
|
|
@@ -343,7 +343,7 @@ def txt2image_title(content, save_target):
|
|
draw.text((5,5), text, (17, 41, 167), font)
|
|
draw.text((5,5), text, (17, 41, 167), font)
|
|
canvas.save(save_target, "PNG")
|
|
canvas.save(save_target, "PNG")
|
|
'''
|
|
'''
|
|
-def call_achor_video_v2(fileName):
|
|
|
|
|
|
+def call_achor_video_v2(fileName,avatar):
|
|
conn = rpyc.classic.connect("192.168.1.105",18812)
|
|
conn = rpyc.classic.connect("192.168.1.105",18812)
|
|
ros = conn.modules.os
|
|
ros = conn.modules.os
|
|
rsys = conn.modules.sys
|
|
rsys = conn.modules.sys
|
|
@@ -363,7 +363,6 @@ def call_achor_video_v2(fileName):
|
|
|
|
|
|
val=random.randint(1000000,9999999)
|
|
val=random.randint(1000000,9999999)
|
|
ros.chdir('/home/jared/to_video')
|
|
ros.chdir('/home/jared/to_video')
|
|
- avatar=6
|
|
|
|
if avatar ==7:
|
|
if avatar ==7:
|
|
ros.system('./p6.sh '+str(val)+' &')
|
|
ros.system('./p6.sh '+str(val)+' &')
|
|
else :
|
|
else :
|
|
@@ -465,7 +464,7 @@ def generate_subtitle_image(name_hash,text_content):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-def anchor_video_v2(name,text_content, image_urls):
|
|
|
|
|
|
+def anchor_video_v2(name,text_content, image_urls,avatar):
|
|
#ws = create_connection("ws://www.choozmo.com:8888/progress")
|
|
#ws = create_connection("ws://www.choozmo.com:8888/progress")
|
|
progress = 0
|
|
progress = 0
|
|
name_hash = str(time.time()).replace('.','')
|
|
name_hash = str(time.time()).replace('.','')
|
|
@@ -480,7 +479,7 @@ def anchor_video_v2(name,text_content, image_urls):
|
|
|
|
|
|
progress_per_video = int(40/len(text_content))
|
|
progress_per_video = int(40/len(text_content))
|
|
for fname in range(len(text_content)):
|
|
for fname in range(len(text_content)):
|
|
- call_achor_video_v2(name_hash+"/"+str(fname))
|
|
|
|
|
|
+ call_achor_video_v2(name_hash+"/"+str(fname),avatar)
|
|
progress += progress_per_video
|
|
progress += progress_per_video
|
|
#ws.send(str(progress))
|
|
#ws.send(str(progress))
|
|
print('step finish')
|
|
print('step finish')
|
|
@@ -634,7 +633,7 @@ def anchor_video_v2(name,text_content, image_urls):
|
|
|
|
|
|
def anchor_video_v3333(name,text_content, image_urls,avatar):
|
|
def anchor_video_v3333(name,text_content, image_urls,avatar):
|
|
ws = create_connection("ws://www.choozmo.com:8888/progress")
|
|
ws = create_connection("ws://www.choozmo.com:8888/progress")
|
|
- progress = 00
|
|
|
|
|
|
+ progress = 0
|
|
|
|
|
|
name_hash = str(time.time()).replace('.','')
|
|
name_hash = str(time.time()).replace('.','')
|
|
|
|
|