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() chunjie_zizhi_count = sql.get_chunjie_zizhi_account_id() ks_yinmei_count = sql.get_ks_yinmei_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) count = int(dy_yinmei_count + koubo_count + ks_yinmei_count +jieri_count) if count == 35: if flag: Feishu.bot('recommend', '拼接视频', '自制视频拼接完成啦,共计45条~') 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() count = int(dy_yinmei_count + koubo_count + ks_yinmei_count+jieri_count) if count < 35: Feishu.bot('recommend', '拼接视频', f'视频生成异常,不符合预期,请检查\n目前生成数量如下:\n抖音视频拼接:{dy_yinmei_count}条 \n快手视频拼接:{ks_yinmei_count}条\n春节-口播:{jieri_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)