|
@@ -183,7 +183,7 @@ def gen_avatar(name_hash, imgurl):
|
|
|
while True:
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
|
|
|
- statement = 'SELECT * FROM avatar_service_status'
|
|
|
+ statement = 'SELECT * FROM avatar_service_status'#only one row in this table, which id 1 one
|
|
|
status = -1
|
|
|
for row in db.query(statement):
|
|
|
status = row['status']
|
|
@@ -198,23 +198,25 @@ def gen_avatar(name_hash, imgurl):
|
|
|
if len(works)==0:
|
|
|
print('leave process loop')
|
|
|
break
|
|
|
+ try:
|
|
|
+ statement = 'UPDATE avatar_service_status SET status = 1 WHERE id=1;'
|
|
|
+ db.query(statement)
|
|
|
+ name_hash = works[0]['name_hash']
|
|
|
+ imgurl = works[0]['imgurl']
|
|
|
+ print(works[0])
|
|
|
+ print(name_hash)
|
|
|
+ print(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'])
|
|
|
+ except:
|
|
|
+ print('gen error')
|
|
|
|
|
|
- statement = 'UPDATE avatar_service_status SET status = 1 WHERE id=1;'
|
|
|
- db.query(statement)
|
|
|
- name_hash = works[0]['name_hash']
|
|
|
- imgurl = works[0]['imgurl']
|
|
|
- print(works[0])
|
|
|
- print(name_hash)
|
|
|
- print(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'])
|
|
|
- statement = 'UPDATE avatar_service_status SET status = 0 WHERE id=1;'
|
|
|
+ statement = 'UPDATE avatar_service_status SET status = 0 WHERE id=1;' #only one row in this table, which id 1 one
|
|
|
db.query(statement)
|
|
|
|
|
|
|