main.py 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import os
  2. import sys
  3. import schedule
  4. import time
  5. sys.path.append(os.getcwd())
  6. from common import Common, Feishu
  7. from video_capture.kuaishou.kuaishou_author.kuaishou_author import kuaishouAuthor
  8. from common.sql_help import sql
  9. from video_stitching.video_stitching import VideoStitching
  10. from video_capture.douyin.douyin_author.douyin_author import douyinAuthor
  11. flag = True
  12. def job_video_stitching():
  13. global flag
  14. dy_yinmei_count = sql.get_dy_yinmei_account_id()
  15. koubo_count = sql.get_koubo_account_id()
  16. jieri_count = sql.get_jieri_account_id()
  17. ks_yinmei_count = sql.get_ks_yinmei_account_id()
  18. # if int(jieri_count) < 20:
  19. # Common.logger("video").info("开始执行-口播-小年")
  20. # video_type = "口播--美文类"
  21. # channel_type = "jieri"
  22. # VideoStitching.video_stitching(video_type, koubo_count, channel_type)
  23. if int(ks_yinmei_count) < 10:
  24. Common.logger("video").info("开始执行-快手")
  25. video_type = "音画美文"
  26. channel_type = "kuaishou"
  27. VideoStitching.video_stitching(video_type, ks_yinmei_count, channel_type)
  28. elif int(dy_yinmei_count) < 10:
  29. Common.logger("video").info("开始执行-抖音")
  30. video_type = "音画美文"
  31. channel_type = "douyin"
  32. VideoStitching.video_stitching(video_type, dy_yinmei_count, channel_type)
  33. elif int(koubo_count) < 10:
  34. Common.logger("video").info("开始执行-口播")
  35. video_type = "口播--美文类"
  36. channel_type = "koubo"
  37. VideoStitching.video_stitching(video_type, koubo_count, channel_type)
  38. count = int(dy_yinmei_count + koubo_count + ks_yinmei_count)
  39. if count == 30:
  40. if flag:
  41. Feishu.bot('recommend', '拼接视频', '自制视频拼接完成啦,共计30条~')
  42. flag = False
  43. if count == 0:
  44. flag = True
  45. def job_feishu_bot():
  46. # jieri_count = sql.get_jieri_account_id()
  47. dy_yinmei_count = sql.get_dy_yinmei_account_id()
  48. koubo_count = sql.get_koubo_account_id()
  49. ks_yinmei_count = sql.get_ks_yinmei_account_id()
  50. count = int(dy_yinmei_count + koubo_count + ks_yinmei_count)
  51. if count < 30:
  52. Feishu.bot('recommend', '拼接视频', f'视频生成异常,不符合预期,请检查\n目前生成数量如下:\n抖音视频拼接:{dy_yinmei_count}条 \n快手视频拼接:{ks_yinmei_count}条\n口播视频拼接:{koubo_count}条')
  53. def job_douyin_data():
  54. douyinAuthor.get_videoList()
  55. def job_kuaishou_data():
  56. kuaishouAuthor.get_kuaishou_videoList()
  57. # 每10个小时执行一次
  58. schedule.every(10).hours.do(job_douyin_data)
  59. # 每10个小时执行一次
  60. schedule.every(10).hours.do(job_kuaishou_data)
  61. # 每15分钟执行一次
  62. schedule.every(15).minutes.do(job_video_stitching)
  63. # 每天下午1:30执行任务
  64. schedule.every().day.at("13:30").do(job_feishu_bot)
  65. while True:
  66. schedule.run_pending()
  67. time.sleep(1)