Bladeren bron

增加等待时长

zhangyong 10 maanden geleden
bovenliggende
commit
f66bed20f8
2 gewijzigde bestanden met toevoegingen van 8 en 8 verwijderingen
  1. 1 1
      common/sql_help.py
  2. 7 7
      video_agc/agc_video.py

+ 1 - 1
common/sql_help.py

@@ -36,7 +36,7 @@ class sqlHelp():
             user = str(random.choice(user_list))
             user = user.replace('(', '').replace(')', '').replace(',', '')
             current_time = datetime.now()
-            three_days_ago = current_time - timedelta(days=3)
+            three_days_ago = current_time - timedelta(days=1)
             formatted_current_time = current_time.strftime("%Y-%m-%d")
             formatted_three_days_ago = three_days_ago.strftime("%Y-%m-%d")
             url_list = f"""SELECT a.video_id, a.account_id, a.oss_object_key 

+ 7 - 7
video_agc/agc_video.py

@@ -389,19 +389,14 @@ class AGC():
             try:
                 d_list = list_data[count]
                 uid = d_list['uid']  # 音频id
-                srt = d_list['text']  # srt
                 cover = d_list['cover']
                 audio_title = d_list['title']
-                # if srt and len(srt.strip()) >= 3:
-                #     # 创建临时字幕文件
-                #     cls.create_subtitle_file(srt, s_path)
-                #     Common.logger("bk_video").info(f"S{mark} 文件目录创建成功")
-                # else:
                 srt_new = SRT.getSrt(int(uid))
                 Common.logger("video").info(f"S{mark}的{platform}渠道音频ID{uid}")
                 if error_count == 5:
                     Feishu.bot('recommend', 'AGC异常通知', f'{platform}渠道音频id为{uid},任务处理异常5次,该任务跳过,请检查格式!', name, mark_name)
                     count += 1
+                    time.sleep(300)
                     continue
                 if srt_new:
                     # 创建临时字幕文件
@@ -412,9 +407,14 @@ class AGC():
                     audio_video = PQ.get_audio_url(uid)
                     Common.logger("video").info(f"{mark}的{platform}渠道获音频成功{audio_video}")
                     audio_duration = cls.get_audio_duration(audio_video)
+                    if int(audio_duration) >= 300:
+                        count += 1
+                        continue
                     Common.logger("video").info(f"{mark}的{platform}渠道获取需要拼接的音频秒数为:{audio_duration}")
                 except Exception as e:
+
                     count += 1
+                    time.sleep(150)
                     # 清空所有mp4数据
                     cls.clear_mp4_files(mark)
                     Feishu.bot('recommend', 'AGC异常通知', f'{platform}任务下,{uid}音频格式填写错误该任务跳过,请关注', name, mark_name)
@@ -522,7 +522,7 @@ class AGC():
                         Feishu.insert_columns("IbVVsKCpbhxhSJtwYOUc8S1jnWb", "jd9qD9", "ROWS", 1, 2)
                         time.sleep(random_wait_time)
                         Feishu.update_values("IbVVsKCpbhxhSJtwYOUc8S1jnWb", "jd9qD9", "A2:Z2", values)
-
+                        time.sleep(300)
             except Exception as e:
                 error_count += 1
                 Common.logger("video").warning(f"{mark}的视频拼接失败:{e}\n")