Browse Source

re-add try except

ming 3 years ago
parent
commit
c6663ab9e5
3 changed files with 5 additions and 5 deletions
  1. BIN
      .DS_Store
  2. 2 2
      OpenshotService/openshot_video_generator.py
  3. 3 3
      api/main.py

BIN
.DS_Store


+ 2 - 2
OpenshotService/openshot_video_generator.py

@@ -154,7 +154,7 @@ def txt2image(content, save_target,lang='zh'):
     if lang=='zh':
         font = ImageFont.truetype(font="font/DFT_B7.ttc", size=38)
     else :
-        font = ImageFont.load("arial.pil")
+        font = ImageFont.truetype(font="font/arial.ttf", size=38)
     text_width, text_height = font.getsize(unicode_text)
     canvas = Image.new('RGBA', (700, 500), (255, 0, 0, 0) )
     draw = ImageDraw.Draw(canvas)
@@ -255,7 +255,7 @@ def generate_subtitle_image_ENG(name_hash,text_content):
 def anchor_video_v2(name_hash,name,text_content, image_urls,avatar):
     print(os.getcwd())
     print('sub image made')
-    file_prepare(name, name_hash, text_content,image_urls,0)
+    file_prepare(name, name_hash, text_content,image_urls)
     sub_list=generate_subtitle_image(name_hash,text_content)
     
     for fname in range(len(text_content)):

+ 3 - 3
api/main.py

@@ -247,8 +247,8 @@ 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'))
-        #try:
-        if True:
+        try:
+        #if True:
             db.query('UPDATE video_queue_status SET status = 1;')
             c = rpyc.connect("localhost", 8878)
             c._config['sync_request_timeout'] = None
@@ -256,7 +256,7 @@ def gen_video_queue(name_hash,name,text_content, image_urls,avatar):
             my_answer = remote_svc.call_video(top1['name_hash'],top1['name'],top1['text_content'].split(','), top1['image_urls'].split(','),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:
+        except:
             print('video generation error')
             notify_group('影片錯誤')
         db['video_queue'].delete(id=top1['id'])