Browse Source

增加异常处理

zhangyong 10 tháng trước cách đây
mục cha
commit
2b96daec06
1 tập tin đã thay đổi với 5 bổ sung3 xóa
  1. 5 3
      video_agc/agc_video.py

+ 5 - 3
video_agc/agc_video.py

@@ -51,7 +51,7 @@ class AGC():
             return ""
         print(f"{mark}的{platform}:开始拼接视频喽~~~")
         Common.logger("video").info(f"{mark}的{platform}:开始拼接视频喽~~~")
-        if os.path.exists(s_path):
+        if os.path.exists(s_path) and os.path.getsize(s_path) != 0:
             # subtitle_cmd = f"subtitles={s_path}:force_style='Fontsize=11,Fontname=Hiragino Sans GB,Outline=0,PrimaryColour=&H000000,SecondaryColour=&H000000'"
             subtitle_cmd = f"subtitles={s_path}:force_style='Fontsize=12,Fontname=wqy-zenhei,Bold=1,Outline=0,PrimaryColour=&H000000,SecondaryColour=&H000000'"
         else:
@@ -200,7 +200,7 @@ class AGC():
             return ""
         print(f"{mark}的{platform}:开始拼接视频喽~~~")
         Common.logger("video").info(f"{mark}的{platform}:开始拼接视频喽~~~")
-        if os.path.exists(s_path):
+        if os.path.exists(s_path) and os.path.getsize(s_path) != 0:
             # subtitle_cmd = f"subtitles={s_path}:force_style='Fontsize=11,Fontname=Hiragino Sans GB,Outline=0,PrimaryColour=&H000000,SecondaryColour=&H000000'"
             subtitle_cmd = f"subtitles={s_path}:force_style='Fontsize=12,Fontname=wqy-zenhei,Bold=1,Outline=0,PrimaryColour=&H000000,SecondaryColour=&H000000'"
         else:
@@ -384,6 +384,8 @@ class AGC():
                     Common.logger("bk_video").info(f"S{mark} 文件目录创建成功")
                 else:
                     srt_new = SRT.getSrt(int(uid))
+                    Common.logger("video").info(f"S{mark}的{platform}渠道音频ID")
+
                     if srt_new:
                         current_time = datetime.now()
                         formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
@@ -395,7 +397,7 @@ class AGC():
                         Feishu.update_values("IbVVsKCpbhxhSJtwYOUc8S1jnWb", "jd9qD9", "A2:Z2", values)
                         # 创建临时字幕文件
                         cls.create_subtitle_file(srt_new, s_path)
-                        Common.logger("video").info(f"S{mark}的{platform}渠道RT 文件目录创建成功")
+                        Common.logger("video").info(f"S{mark}的{platform}渠道SRT 文件目录创建成功")
                 # 获取音频
                 audio_video = PQ.get_audio_url(uid)
                 Common.logger("video").info(f"{mark}的{platform}渠道获音频成功")