zhangyong 9 months ago
parent
commit
8ae9818e95
1 changed files with 1 additions and 7 deletions
  1. 1 7
      video_rewriting/video_processor.py

+ 1 - 7
video_rewriting/video_processor.py

@@ -75,6 +75,7 @@ class VideoProcessor:
         """
         处理单个任务
         """
+        cls.remove_files(mark)
         video_path_url = cls.create_folders(mark)
         task_mark = task["task_mark"]
         channel_id = str(task["channel_id"])
@@ -110,7 +111,6 @@ class VideoProcessor:
             )
             Feishu.finish_bot(text, "https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
                               "【 机器改造通知 】")
-            cls.remove_files(mark)
             return
         Common.logger(mark).info(f"{name}的{task_mark}下的ID{url} 获取视频完成,共{len(data_list)}条")
         for video in data_list:
@@ -155,13 +155,11 @@ class VideoProcessor:
                     Feishu.finish_bot(text,
                                       "https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
                                       "【 机器改造通知 】")
-                    cls.remove_files(mark)
                     continue
                 if new_video_path:
                     if video_ending and video_ending != 'None':
                         new_video_path = cls.handle_video_ending(new_video_path, video_ending, old_title, pw_random_id, video_path_url, mark, task_mark, url, name, video_share, zm, voice)
                         if new_video_path == None:
-                            cls.remove_files(mark)
                             continue
                     else:
                         if video_share and video_share != 'None':
@@ -181,7 +179,6 @@ class VideoProcessor:
                         Feishu.finish_bot(text,
                                           "https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
                                           "【 机器改造通知 】")
-                        cls.remove_files(mark)
                         continue
                     # 上传视频和封面,并更新数据库
                     code = cls.upload_video_and_thumbnail(new_video_path, cover, v_id, new_title, task_mark, name, piaoquan_id,
@@ -310,10 +307,8 @@ class VideoProcessor:
                         Feishu.insert_columns("ILb4sa0LahddRktnRipcu2vQnLb", sheet, "ROWS", 1, 2)
                         time.sleep(0.5)
                         Feishu.update_values("ILb4sa0LahddRktnRipcu2vQnLb", sheet, "A2:Z2", values)
-                cls.remove_files(mark)
             except Exception as e:
                 Common.logger(mark).info(f"{name}的{task_mark}任务处理失败:{e}")
-                cls.remove_files(mark)
                 continue
 
     @classmethod
@@ -522,7 +517,6 @@ class VideoProcessor:
 
                 return code
         except Exception as e:
-            cls.remove_files(mark)
             Common.logger("error").warning(f"{name}的{task_mark}上传视频和封面到OSS,并更新数据库失败:{e}\n")
             return