소스 검색

gen video queue

ming 3 년 전
부모
커밋
db4cc609b6
1개의 변경된 파일12개의 추가작업 그리고 11개의 파일을 삭제
  1. 12 11
      api/main.py

+ 12 - 11
api/main.py

@@ -235,17 +235,18 @@ def gen_video_queue(name_hash,name,text_content, image_urls,avatar):
             print('all finish, leave loop')
             break
         top1 = first(db.query('SELECT * FROM video_queue'))
-        
-        db.query('UPDATE video_queue_status SET status = 1;')
-        c = rpyc.connect("localhost", 8868)
-        c._config['sync_request_timeout'] = None
-        remote_svc = c.root
-        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')
-        
-        print('video generation error')
-        notify_group('影片錯誤')
+        try:
+            db.query('UPDATE video_queue_status SET status = 1;')
+            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')
+        except:
+            print('video generation error')
+            notify_group('影片錯誤')
         db['video_queue'].delete(id=top1['id'])
         db.query('UPDATE video_queue_status SET status = 0')