Browse Source

gen video queue

ming 3 years ago
parent
commit
768a25acd3
1 changed files with 9 additions and 2 deletions
  1. 9 2
      api/main.py

+ 9 - 2
api/main.py

@@ -226,7 +226,15 @@ def gen_video_eng(name_hash,name,text_content, image_urls,sub_titles,avatar):
 def gen_video_queue(name_hash,name,text_content, image_urls,avatar):
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
     time_stamp = datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d %H:%M:%S")
-    db['video_queue'].insert({'name_hash':name_hash,'name':name,'text_content':text_content,'image_urls':image_urls,'avatar':avatar,'timestamp':time_stamp})
+    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]
+    db['video_queue'].insert({'name_hash':name_hash,'name':name,'text_content':txt_content_seperate_by_dot,'image_urls':img_urls_seperate_by_dot,'avatar':avatar,'timestamp':time_stamp})
     while True:
         if first(db.query('SELECT * FROM video_queue_status'))['status'] == 1:#only one row in this table, which is the id 1 one
             print('another process running, leave loop')
@@ -240,7 +248,6 @@ def gen_video_queue(name_hash,name,text_content, image_urls,avatar):
             c = rpyc.connect("localhost", 8868)
             c._config['sync_request_timeout'] = None
             remote_svc = c.root
-            print(top1)
             my_answer = remote_svc.call_video(top1['name_hash'],top1['name'],top1['text_content'], top1['image_urls'],top1['avatar']) # method call
             shutil.copy(tmp_video_dir+top1['name_hash']+'.mp4',video_dest+top1['name_hash']+'.mp4')
             os.remove(tmp_video_dir+top1['name_hash']+'.mp4')