zhangyong 10 месяцев назад
Родитель
Сommit
14abbcdebf
1 измененных файлов с 28 добавлено и 23 удалено
  1. 28 23
      video_rewriting/video_processor.py

+ 28 - 23
video_rewriting/video_processor.py

@@ -162,7 +162,7 @@ class VideoProcessor:
                         cls.remove_files(video_path_url)
                         continue
                     # 上传视频和封面,并更新数据库
-                    values, code = cls.upload_video_and_thumbnail(new_video_path, cover, v_id, new_title, task_mark, name, piaoquan_id,
+                    code = cls.upload_video_and_thumbnail(new_video_path, cover, v_id, new_title, task_mark, name, piaoquan_id,
                                                    video_path_url, mark, channel_id, url, old_title, title, rule)
                     # 更新已使用的视频号状态
                     pq_url = f'https://admin.piaoquantv.com/cms/post-detail/{code}/detail'  # 站内视频链接
@@ -195,6 +195,29 @@ class VideoProcessor:
                     Feishu.finish_bot(text,
                                       "https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
                                       "【 机器改造通知 】")
+                    if channel_id == "快手历史" or channel_id == "抖音历史":
+                        explain = "历史爆款"
+                    else:
+                        explain = "新供给"
+                    current_time = datetime.now()
+                    formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
+                    values = [
+                        [
+                            name,
+                            task_mark,
+                            channel_id,
+                            url,
+                            str(v_id),
+                            piaoquan_id,
+                            old_title,
+                            title if title in ["原标题", "AI标题"] else "",
+                            new_title,
+                            str(code),
+                            formatted_time,
+                            str(rule),
+                            explain
+                        ]
+                    ]
                     if values:
                         if name == "王雪珂":
                             sheet = "vfhHwj"
@@ -412,30 +435,12 @@ class VideoProcessor:
                 sqlCollect.insert_task(task_mark, v_id, mark, channel_id)  # 插入数据库
                 current_time = datetime.now()
                 formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
+                if name == "单点视频":
+                    url = str(rule)
                 sqlCollect.insert_machine_making_data(name, task_mark, channel_id, url, v_id, piaoquan_id, new_title, code,
                                                       formatted_time, old_title, oss_object_key)
-                if channel_id == "快手历史" or channel_id == "抖音历史":
-                    explain = "历史爆款"
-                else:
-                    explain = "新供给"
-                values = [
-                    [
-                        name,
-                        task_mark,
-                        channel_id,
-                        url,
-                        str(v_id),
-                        piaoquan_id,
-                        old_title,
-                        title if title in ["原标题", "AI标题"] else "",
-                        new_title,
-                        str(code),
-                        formatted_time,
-                        str(rule),
-                        explain
-                    ]
-                ]
-                return values, code
+
+                return code
         except Exception as e:
             cls.remove_files(video_path_url)
             Common.logger("error").warning(f"{name}的{task_mark}上传视频和封面到OSS,并更新数据库失败:{e}\n")