zhangyong 2 bulan lalu
induk
melakukan
61e5c47edb
2 mengubah file dengan 4 tambahan dan 14 penghapusan
  1. 0 11
      utils/aliyun_log.py
  2. 4 3
      workers/consumption_work.py

+ 0 - 11
utils/aliyun_log.py

@@ -2,9 +2,6 @@
 """
 公共方法,包含:生成log / 删除log
 """
-import json
-from datetime import date, timedelta
-from datetime import datetime
 from typing import Optional
 from loguru import logger
 
@@ -15,14 +12,6 @@ proxies = {"http": None, "https": None}
 
 
 class AliyunLogger:
-    # 统一获取当前时间 <class 'datetime.datetime'>  2022-04-14 20:13:51.244472
-    now = datetime.now()
-    # 昨天 <class 'str'>  2022-04-13
-    yesterday = (date.today() + timedelta(days=-1)).strftime("%Y-%m-%d")
-    # 今天 <class 'datetime.date'>  2022-04-14
-    today = date.today()
-    # 明天 <class 'str'>  2022-04-15
-    tomorrow = (date.today() + timedelta(days=1)).strftime("%Y-%m-%d")
 
     # 写入阿里云日志
     @staticmethod

+ 4 - 3
workers/consumption_work.py

@@ -19,7 +19,7 @@ class ConsumptionRecommend(object):
     @classmethod
     async def run(cls):
         logger.info(f"[处理] 开始获取redis数据")
-        task = await RedisHelper().get_client().rpop(name = 'task:video_ai_pq')
+        task = RedisHelper().get_client().rpop(name = 'task:video_ai_pq')
         if not task:
             logger.info('[处理] 无待执行的扫描任务')
             return
@@ -32,11 +32,12 @@ class ConsumptionRecommend(object):
             return
         logger.info(f"[处理] 获取原视频OSS地址,视频链接:{video_path}")
         video_url = f"http://rescdn.yishihui.com/{video_path}"
-        logger.info(f"[处理] 开始提取口播文案")
+        logger.info(f"[处理] 开始分析视频")
         api_key = os.getenv("GEMINI_API_KEY")
+        # api_key = 'AIzaSyA637WjFSjVEKLHt09wbVdB01gwzZKM0Rg'
         logger.info(f"[处理] 使用的API_KEY:{api_key}")
         text = GoogleAI.run(api_key, video_url)
-        AliyunLogger.logging(str(video_id), task['title'], task['video_path'], "", task['type'], task['partition'], text)
+        AliyunLogger.logging(str(video_id), task['title'], task['video_path'], "", task['type'], task['partition'], str(text))
         logger.info(f"[处理] 写入日志成功")