Forráskód Böngészése

片尾引导增加多选

zhangyong 11 hónapja
szülő
commit
04d1e363c8
3 módosított fájl, 15 hozzáadás és 10 törlés
  1. 1 1
      common/ffmpeg.py
  2. 1 1
      video_job.py
  3. 13 8
      video_rewriting/video_prep.py

+ 1 - 1
common/ffmpeg.py

@@ -119,7 +119,7 @@ class FFmpeg():
         total_duration = cls.get_video_duration(new_video_path)
         duration = int(total_duration) - int(gg_duration_total)
         if int(total_duration) < int(gg_duration_total):
-            duration = int(total_duration)
+            return new_video_path
         ffmpeg_cmd = [
             "ffmpeg",
             "-i", new_video_path,

+ 1 - 1
video_job.py

@@ -71,7 +71,7 @@ def usernames_today():
     print("today 已清空")
 
 
-# video_start()
+video_start()
 
 
 # 定时任务设置

+ 13 - 8
video_rewriting/video_prep.py

@@ -92,14 +92,7 @@ class getVideo:
                 zm = Material.get_pzsrt_data(feishu_id, pz_sheet, video_share_name)  # 获取srt
                 if zm == '':
                     Feishu.bot(mark, '机器自动改造消息通知', f'{task_marks}任务下片中标示填写错误,请关注!!!!', name)
-            if video_ending and video_ending != 'None':
-                pw_list = Material.get_pwsrt_data(feishu_id, pw_sheet, video_ending)  # 获取srt
-                if pw_list:
-                    pw_id = pw_list["pw_id"]
-                    pw_srt = pw_list["pw_srt"]
-                    pw_url = PQ.get_pw_url(pw_id)
-                else:
-                    Feishu.bot(mark, '机器自动改造消息通知', f'{task_marks}任务下片尾标示错误,请关注!!!!', name)
+
             if ',' in new_id:
                 n_id = new_id.split(',')
             else:
@@ -144,6 +137,18 @@ class getVideo:
                         if gg_duration_total and gg_duration_total != 'None':  # 判断是否需要指定视频时长
                             new_video_path = FFmpeg.video_ggduration(new_video_path, video_path_url, pw_random_id, gg_duration_total)
                         if video_ending and video_ending != 'None':
+                            if ',' in video_ending:
+                                video_ending_list = video_ending.split(',')
+                            else:
+                                video_ending_list = [video_ending]
+                            ending = random.choice(video_ending_list)
+                            pw_list = Material.get_pwsrt_data(feishu_id, pw_sheet, ending)  # 获取srt
+                            if pw_list:
+                                pw_id = pw_list["pw_id"]
+                                pw_srt = pw_list["pw_srt"]
+                                pw_url = PQ.get_pw_url(pw_id)
+                            else:
+                                Feishu.bot(mark, '机器自动改造消息通知', f'{task_marks}任务下片尾标示错误,请关注!!!!', name)
                             for attempt in range(3):
                                 jpg_path = FFmpeg.video_png(new_video_path, video_path_url, pw_random_id)  # 生成视频最后一帧jpg
                                 if os.path.isfile(jpg_path):