zhangyong 1 年之前
父节点
当前提交
4e3148e62f
共有 3 个文件被更改,包括 20 次插入9 次删除
  1. 18 6
      common/material.py
  2. 1 2
      main.py
  3. 1 1
      video_stitching/video_stitching.py

+ 18 - 6
common/material.py

@@ -3,9 +3,10 @@
 import os
 import random
 import sys
+import datetime
 
 sys.path.append(os.getcwd())
-
+from datetime import datetime, timedelta
 from common.db import MysqlHelper
 from common.feishu import Feishu
 
@@ -98,13 +99,21 @@ class Material():
             if item[0] == '管理后台':
                 return item[1]
 
+    def get_id(cls, audio_id):
+        current_time = datetime.now()
+        previous_day = current_time - timedelta(days=1)
+        formatted_time = previous_day.strftime("%Y-%m-%d")
+        id_list = f"""select * FROM video_audio where time = '{formatted_time}' AND audio = '{audio_id}'"""
+        id_list = MysqlHelper.get_values(id_list, "prod")
+        return id_list
+
     # 获取音频类型
     @classmethod
     def get_audio_type(cls, video_type, count, channel_type):
         list = []
         title_list = []
         if video_type == "口播--美文类":
-            if channel_type == "xiaonian":
+            if channel_type == "jieri":
                 audio_type = Feishu.get_values_batch("prod", "succinct", "djrml0")
             else:
                 audio_type = Feishu.get_values_batch("prod", "succinct", "Sed8gy")
@@ -164,10 +173,13 @@ class Material():
                     if audio_id:
                         list.append(number)
                     title_list.append(title)
-                list = random.choice(list)
-                audio_id = list['audio_id']
-                srt = list['text']
-                return audio_id, srt, title_list
+                while True:
+                    list = random.choice(list)
+                    audio_id = list['audio_id']
+                    srt = list['text']
+                    id_list = cls.get_id(audio_id)
+                    if id_list == None:
+                        return audio_id, srt, title_list
 
 
 

+ 1 - 2
main.py

@@ -8,7 +8,6 @@ from common import Common, Feishu
 from video_capture.kuaishou.kuaishou_author.kuaishou_author import kuaishouAuthor
 from common.sql_help import sql
 from video_stitching.video_stitching import VideoStitching
-
 from video_capture.douyin.douyin_author.douyin_author import douyinAuthor
 
 
@@ -24,7 +23,7 @@ def job_video_stitching():
     # if int(jieri_count) < 20:
     #     Common.logger("video").info("开始执行-口播-小年")
     #     video_type = "口播--美文类"
-    #     channel_type = "xiaonian"
+    #     channel_type = "jieri"
     #     VideoStitching.video_stitching(video_type, koubo_count, channel_type)
     if int(ks_yinmei_count) < 10:
         Common.logger("video").info("开始执行-快手")

+ 1 - 1
video_stitching/video_stitching.py

@@ -74,7 +74,7 @@ class VideoStitching():
     def insert_video_typeAudio(cls, video, audio_id, channel_type):
         current_time = datetime.now()
         formatted_time = current_time.strftime("%Y-%m-%d")
-        if channel_type == "xiaonian":
+        if channel_type == "jieri":
             video_type = 3
         else:
             video_type = 1