Prechádzať zdrojové kódy

add image display test

ming 3 rokov pred
rodič
commit
429ca40859

+ 6 - 5
OpenshotService/openshot_video_generator.py

@@ -655,12 +655,13 @@ def video_gen(name_hash,name,text_content, image_urls,multiLang,avatar):
     img_clip_list = [None]*len(listdir(dir_photo+name_hash))
     img_clip_list = [None]*len(listdir(dir_photo+name_hash))
     img_list = [None]*len(img_clip_list)
     img_list = [None]*len(img_clip_list)
     for p in listdir(dir_photo+name_hash):
     for p in listdir(dir_photo+name_hash):
-        img_list[idx] = openshot.FFmpegReader(dir_photo+name_hash+'/'+p)
-        img_list[idx].Open()
-        img_clip_list[idx] = video_photo_clip(vid=img_list[idx],layer=3
+        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)
                 ,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[idx])
-        img_list[idx].Close()
+        t.AddClip(img_clip_list[p_idx])
+        img_list[p_idx].Close()
 
 
     anchor = openshot.FFmpegReader(dir_anchor+name_hash+"/0.mp4")
     anchor = openshot.FFmpegReader(dir_anchor+name_hash+"/0.mp4")
     anchor.Open()
     anchor.Open()