12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- import os
- import sys
- import schedule
- import time
- sys.path.append(os.getcwd())
- 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
- flag = True
- def job_video_stitching():
- global flag
- dy_yinmei_count = sql.get_dy_yinmei_account_id()
- koubo_count = sql.get_koubo_account_id()
- jieri_count = sql.get_jieri_account_id()
- ks_yinmei_count = sql.get_ks_yinmei_account_id()
- # if int(jieri_count) < 20:
- # Common.logger("video").info("开始执行-口播-小年")
- # video_type = "口播--美文类"
- # channel_type = "jieri"
- # VideoStitching.video_stitching(video_type, koubo_count, channel_type)
- if int(ks_yinmei_count) < 10:
- Common.logger("video").info("开始执行-快手")
- video_type = "音画美文"
- channel_type = "kuaishou"
- VideoStitching.video_stitching(video_type, ks_yinmei_count, channel_type)
- elif int(dy_yinmei_count) < 10:
- Common.logger("video").info("开始执行-抖音")
- video_type = "音画美文"
- channel_type = "douyin"
- VideoStitching.video_stitching(video_type, dy_yinmei_count, channel_type)
- elif int(koubo_count) < 10:
- Common.logger("video").info("开始执行-口播")
- video_type = "口播--美文类"
- channel_type = "koubo"
- VideoStitching.video_stitching(video_type, koubo_count, channel_type)
- count = int(dy_yinmei_count + koubo_count + ks_yinmei_count)
- if count == 30:
- if flag:
- Feishu.bot('recommend', '拼接视频', '自制视频拼接完成啦,共计30条~')
- flag = False
- if count == 0:
- flag = True
- def job_feishu_bot():
- # jieri_count = sql.get_jieri_account_id()
- dy_yinmei_count = sql.get_dy_yinmei_account_id()
- koubo_count = sql.get_koubo_account_id()
- ks_yinmei_count = sql.get_ks_yinmei_account_id()
- count = int(dy_yinmei_count + koubo_count + ks_yinmei_count)
- if count < 30:
- Feishu.bot('recommend', '拼接视频', f'视频生成异常,不符合预期,请检查\n目前生成数量如下:\n抖音视频拼接:{dy_yinmei_count}条 \n快手视频拼接:{ks_yinmei_count}条\n口播视频拼接:{koubo_count}条')
- def job_douyin_data():
- douyinAuthor.get_videoList()
- def job_kuaishou_data():
- kuaishouAuthor.get_kuaishou_videoList()
- # 每10个小时执行一次
- schedule.every(10).hours.do(job_douyin_data)
- # 每10个小时执行一次
- schedule.every(10).hours.do(job_kuaishou_data)
- # 每15分钟执行一次
- schedule.every(15).minutes.do(job_video_stitching)
- # 每天下午1:30执行任务
- schedule.every().day.at("13:30").do(job_feishu_bot)
- while True:
- schedule.run_pending()
- time.sleep(1)
|