소스 검색

add image display test

ming 3 년 전
부모
커밋
c4c8490727
1개의 변경된 파일16개의 추가작업 그리고 8개의 파일을 삭제
  1. 16 8
      OpenshotService/openshot_video_generator.py

+ 16 - 8
OpenshotService/openshot_video_generator.py

@@ -654,14 +654,22 @@ def video_gen(name_hash,name,text_content, image_urls,multiLang,avatar):
     #            new_dic['image_obj'] = {'start':dic['start'],'idx':dic['image_idx']}
     img_clip_list = [None]*len(listdir(dir_photo+name_hash))
     img_list = [None]*len(img_clip_list)
-    for p in listdir(dir_photo+name_hash):
-        p_idx = int(p)-1
-        img_list[p_idx] = openshot.FFmpegReader(dir_photo+name_hash+'/'+p)
-        img_list[p_idx].Open()
-        img_clip_list[p_idx] = video_photo_clip(vid=img_list[p_idx],layer=3
-                ,scale_x=0.81,scale_y=0.68,location_y=-0.03,position=img_dict_ls[int(p)+1]['start'],end=img_dict_ls[int(p)+1]['duration'],audio=False)
-        t.AddClip(img_clip_list[p_idx])
-        img_list[p_idx].Close()
+    #for p in listdir(dir_photo+name_hash):
+    #    p_idx = int(p)-1
+    #    img_list[p_idx] = openshot.FFmpegReader(dir_photo+name_hash+'/'+p)
+    #    img_list[p_idx].Open()
+    #    img_clip_list[p_idx] = video_photo_clip(vid=img_list[p_idx],layer=3
+    #            ,scale_x=0.81,scale_y=0.68,location_y=-0.03,position=img_dict_ls[int(p)+1]['start'],end=img_dict_ls[int(p)+1]['duration'],audio=False)
+    #    t.AddClip(img_clip_list[p_idx])
+    #    img_list[p_idx].Close()
+    img_file_ls = listdir(dir_photo+name_hash)
+    for img_idx in range(len(img_file_ls)):
+        img_list[img_idx] = openshot.FFmpegReader(dir_photo+name_hash+'/'+img_file_ls[img_idx])
+        img_list[img_idx].Open()
+        img_clip_list[img_idx] = video_photo_clip(vid=img_list[img_idx],layer=3
+                ,scale_x=0.81,scale_y=0.68,location_y=-0.03,position=img_dict_ls[img_idx]['start'],end=img_dict_ls[img_idx]['duration'],audio=False)
+        t.AddClip(img_clip_list[img_idx])
+        img_list[img_idx].Close()
 
     anchor = openshot.FFmpegReader(dir_anchor+name_hash+"/0.mp4")
     anchor.Open()