ming před 3 roky
rodič
revize
60810ebcf1
1 změnil soubory, kde provedl 6 přidání a 7 odebrání
  1. 6 7
      main.py

+ 6 - 7
main.py

@@ -59,6 +59,7 @@ class request(BaseModel):
     name: str
     text_content: List[str]
     image_urls: List[str]
+    avatar: str
 
 
 class ConnectionManager:
@@ -123,8 +124,7 @@ async def make_anchor_video_v2(req:request):
     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,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()
     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)
     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)
     ros = conn.modules.os 
     rsys = conn.modules.sys 
@@ -363,7 +363,6 @@ def call_achor_video_v2(fileName):
 
     val=random.randint(1000000,9999999)
     ros.chdir('/home/jared/to_video')
-    avatar=6
     if avatar ==7:
         ros.system('./p6.sh '+str(val)+' &')
     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")
     progress = 0
     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))
     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
         #ws.send(str(progress))
         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):
     ws = create_connection("ws://www.choozmo.com:8888/progress")
-    progress = 00
+    progress = 0
 
     name_hash = str(time.time()).replace('.','')