12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import os
- import sys
- import datetime
- import schedule
- import time
- sys.path.append(os.getcwd())
- from datetime import datetime
- from common import MysqlHelper, Common
- from video_stitching.video_stitching import VideoStitching
- from video_capture.douyin.douyin_author.douyin_author import douyinAuthor
- def get_account_id():
- current_time = datetime.now()
- formatted_time = current_time.strftime("%Y-%m-%d")
- count = f"""SELECT COUNT(*) AS total_count FROM ( SELECT audio, account_id FROM video_audio WHERE time = '{formatted_time}' GROUP BY audio, account_id) AS subquery;"""
- print(count)
- count = MysqlHelper.get_values(count, "prod")
- return count
- def job_video_stitching():
- # 在这里编写需要执行的任务代码
- count = get_account_id()
- if count == None:
- count = 0
- count = str(count).replace('(', '').replace(')', '').replace(',', '')
- if int(count) < 20:
- Common.logger().info("开始执行")
- VideoStitching.video_stitching()
- def job_douyin_data():
- douyinAuthor.get_videoList()
- # 每5个小时执行一次
- schedule.every(5).hours.do(job_douyin_data)
- # 每15分钟执行一次
- schedule.every(15).minutes.do(job_video_stitching)
- while True:
- schedule.run_pending()
- time.sleep(1)
|