浏览代码

long vide fix

ming 3 年之前
父节点
当前提交
b10106dc61
共有 1 个文件被更改,包括 11 次插入9 次删除
  1. 11 9
      OpenshotService/openshot_video_generator.py

+ 11 - 9
OpenshotService/openshot_video_generator.py

@@ -468,15 +468,17 @@ def adjustSub_by_text_similarity(gts_in,gens_raw):
     duplicated_list = []
     for idx in range(len(gens)):
         match_text = difflib.get_close_matches(gens[idx], alls, cutoff=0.1)
-
-        if match_text[0] in duplicated_list:
-            for mt in match_text:
-                if mt == adjusted[idx-1]: #or mt not in duplicated_list:
-                    adjusted[idx] = mt
-                    break
-        else:
-            adjusted[idx] = match_text[0]
-            duplicated_list.append(match_text[0])
+        if match_text is not None:
+            if match_text[0] in duplicated_list:
+                for mt in match_text:
+                    if mt == adjusted[idx-1]: #or mt not in duplicated_list:
+                        adjusted[idx] = mt
+                        break
+            else:
+                adjusted[idx] = match_text[0]
+                duplicated_list.append(match_text[0])
+        else :
+            adjusted[idx] = gens[idx]
         
         if None == adjusted[idx]:
             adjusted[idx] = gens[idx]