Browse Source

new interface

ming 3 years ago
parent
commit
8a6cdd4409
1 changed files with 17 additions and 17 deletions
  1. 17 17
      api/main.py

+ 17 - 17
api/main.py

@@ -206,24 +206,24 @@ 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')
+     
+        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')
             
-        except:
-            print('gen error')
-            notify_group('無法辨識人臉')
+      
+        print('gen error')
+        notify_group('無法辨識人臉')
         db['avatar_queue'].delete(id=works[0]['id'])
         statement = 'UPDATE avatar_service_status SET status = 0 WHERE id=1;'  #only one row in this table, which id 1 one
         db.query(statement)