|
@@ -21,13 +21,42 @@ config.read('./config.ini') # 替换为您的配置文件路径
|
|
|
|
|
|
class AgcVidoe():
|
|
|
|
|
|
+ # 获取未使用的视频链接
|
|
|
+ @classmethod
|
|
|
+ def get_url_gs_list(cls, user_list, mark, limit_count):
|
|
|
+ for i in range(5):
|
|
|
+ user = str(random.choice(user_list))
|
|
|
+ current_time = datetime.now()
|
|
|
+ three_days_ago = current_time - timedelta(days=3)
|
|
|
+ formatted_current_time = current_time.strftime("%Y-%m-%d")
|
|
|
+ formatted_three_days_ago = three_days_ago.strftime("%Y-%m-%d")
|
|
|
+ if limit_count == 1:
|
|
|
+ url_list = f"""SELECT a.video_id,a.account_id,a.oss_object_key FROM agc_video_url a WHERE NOT EXISTS (
|
|
|
+ SELECT video_id
|
|
|
+ FROM agc_video_deposit b
|
|
|
+ WHERE a.oss_object_key = b.oss_object_key AND b.time = '{formatted_current_time}'
|
|
|
+ ) AND a.account_id = '{user}' and a.`status` = 1 and a.mark = '{mark}' limit {limit_count};"""
|
|
|
+ url_list = MysqlHelper.get_values(url_list, "prod")
|
|
|
+ if url_list:
|
|
|
+ return url_list
|
|
|
+ else:
|
|
|
+ url_list = f"""SELECT a.video_id,a.account_id,a.oss_object_key FROM agc_video_url a WHERE NOT EXISTS (
|
|
|
+ SELECT video_id
|
|
|
+ FROM agc_video_deposit b
|
|
|
+ WHERE a.oss_object_key = b.oss_object_key AND b.time >= '{formatted_three_days_ago}' AND b.time <= '{formatted_current_time}'
|
|
|
+ ) AND a.account_id = '{user}' and a.`status` = 1 and a.mark = '{mark}' limit {limit_count};"""
|
|
|
+ url_list = MysqlHelper.get_values(url_list, "prod")
|
|
|
+ if url_list:
|
|
|
+ if len(url_list) >= 30:
|
|
|
+ return url_list
|
|
|
+ return None
|
|
|
+
|
|
|
# 获取未使用的视频链接
|
|
|
@classmethod
|
|
|
def get_url_list(cls, user_list, mark, limit_count):
|
|
|
for i in range(5):
|
|
|
user = str(random.choice(user_list))
|
|
|
- if "-" not in mark:
|
|
|
- user = user.replace('(', '').replace(')', '').replace(',', '')
|
|
|
+ user = user.replace('(', '').replace(')', '').replace(',', '')
|
|
|
current_time = datetime.now()
|
|
|
three_days_ago = current_time - timedelta(days=3)
|
|
|
formatted_current_time = current_time.strftime("%Y-%m-%d")
|
|
@@ -539,7 +568,7 @@ class AgcVidoe():
|
|
|
if zw_count >= int(count):
|
|
|
return video_call
|
|
|
limit_count = 1
|
|
|
- url_list = cls.get_url_list(video_list, mark, limit_count)
|
|
|
+ url_list = cls.get_url_gs_list(video_list, mark, limit_count)
|
|
|
if url_list == None:
|
|
|
Common.logger("gs_video").info(f"{mark}的{platform} 渠道 视频画面不足无法拼接")
|
|
|
return
|