|
@@ -180,25 +180,31 @@ def gen_video(name_hash,name,text_content, image_urls,avatar,client_id):
|
|
|
|
|
|
|
|
|
def gen_avatar(name_hash, imgurl):
|
|
|
-
|
|
|
-
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
+ db['avatar_queue'].insert({'name_hash':name_hash,'imgurl':imgurl})
|
|
|
while True:
|
|
|
- directory= os.listdir('../../face_swap/tmp_face/')
|
|
|
- if len(directory) != 0 and not os.path.isdir('../../face_swap/queueFlag'):
|
|
|
- os.mkdir('../../face_swap/queueFlag')
|
|
|
- c = rpyc.connect("localhost", 8868)
|
|
|
- c._config['sync_request_timeout'] = None
|
|
|
- remote_svc = c.root
|
|
|
- q_name = directory[0]
|
|
|
- my_answer = remote_svc.call_avatar(q_name,imgurl) # method call
|
|
|
-
|
|
|
- shutil.copy(tmp_avatar_dir+q_name+'.mp4',avatar_dest+q_name+'.mp4')
|
|
|
- os.remove(tmp_avatar_dir+q_name+'.mp4')
|
|
|
- shutil.rmtree('../../face_swap/queueFlag')
|
|
|
- os.remove('../../face_swap/tmp_face/'+q_name+'.jpg')
|
|
|
- else:
|
|
|
+ if len(works)==0:
|
|
|
break
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
+ statement = 'SELECT * FROM avatar_queue'
|
|
|
+ works = []
|
|
|
+ for row in db.query(statement):
|
|
|
+ works.append({'id':row['id'],'name_hash':row['name_hash'],'imgurl':['imgurl']})
|
|
|
+ name_hash = works[0].name_hash
|
|
|
+ imgurl = works[0].imgurl
|
|
|
+ c = rpyc.connect("localhost", 8868)
|
|
|
+ c._config['sync_request_timeout'] = None
|
|
|
+ remote_svc = c.root
|
|
|
+ my_answer = remote_svc.call_avatar(name_hash,imgurl) # method call
|
|
|
+
|
|
|
+ shutil.copy(tmp_avatar_dir+name_hash+'.mp4',avatar_dest+name_hash+'.mp4')
|
|
|
+ os.remove(tmp_avatar_dir+name_hash+'.mp4')
|
|
|
+ db['avatar_queue'].delete(id=works[0].id)
|
|
|
+
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|