12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import os
- import sys
- import schedule
- import time
- sys.path.append(os.getcwd())
- from common import Common, Feishu
- from common.sql_help import sql
- from video_stitching.video_stitching import VideoStitching
- 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()
- # chunjie_zizhi_count = sql.get_chunjie_zizhi_account_id()
- ks_yinmei_count = sql.get_ks_yinmei_account_id()
- pjdouyin_account_id = sql.get_pjdouyin_account_id()
- ksdouyin_account_id = sql.get_ksdouyin_account_id()
- 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(chunjie_zizhi_count) < 10:
- # Common.logger("video").info("开始执行-自制-春节")
- # video_type = "自制--春节"
- # channel_type = "kschunjie"
- # VideoStitching.video_stitching(video_type, dy_yinmei_count, channel_type)
- # elif int(jieri_count) < 5:
- # Common.logger("video").info("开始执行-口播-春节")
- # video_type = "口播--美文类"
- # channel_type = "jieri"
- # VideoStitching.video_stitching(video_type, koubo_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)
- elif int(pjdouyin_account_id) < 5:
- Common.logger("video").info("开始执行-抖音拼接")
- video_type = "抖音-拼接类"
- channel_type = "dypinjie"
- VideoStitching.video_stitching_pinjie(video_type, pjdouyin_account_id, channel_type)
- elif int(ksdouyin_account_id) < 5:
- Common.logger("video").info("开始执行-快手拼接")
- video_type = "快手-拼接类"
- channel_type = "kspinjie"
- VideoStitching.video_stitching_pinjie(video_type, pjdouyin_account_id, channel_type)
- count = int(dy_yinmei_count + koubo_count + ks_yinmei_count + pjdouyin_account_id + ksdouyin_account_id)
- Common.logger("video").info(f"视频生成条数为:{count}")
- if count == 40:
- if flag:
- Feishu.bot('recommend', '拼接视频', '自制视频拼接完成啦,共计40条~')
- 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()
- # chunjie_zizhi_count = sql.get_chunjie_zizhi_account_id()
- pjdouyin_account_id = sql.get_pjdouyin_account_id()
- ksdouyin_account_id = sql.get_ksdouyin_account_id()
- count = int(dy_yinmei_count + koubo_count + ks_yinmei_count + pjdouyin_account_id + ksdouyin_account_id)
- if count < 40:
- Feishu.bot('recommend', '拼接视频', f'视频生成异常,不符合预期,请检查\n目前生成数量如下:\n抖音-纯拼接类:{pjdouyin_account_id}条\n快手-纯拼接类:{ksdouyin_account_id}条\n抖音-拼接类:{dy_yinmei_count}条 \n快手-拼接类:{ks_yinmei_count}条\n口播-拼接类:{koubo_count}条')
- # 每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)
|