main.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. chunjie_zizhi_count = sql.get_chunjie_zizhi_account_id()
  18. ks_yinmei_count = sql.get_ks_yinmei_account_id()
  19. # elif int(jieri_count) < 10:
  20. # Common.logger("video").info("开始执行-口播-春节")
  21. # video_type = "口播--美文类"
  22. # channel_type = "jieri"
  23. # VideoStitching.video_stitching(video_type, koubo_count, channel_type)
  24. if int(ks_yinmei_count) < 10:
  25. Common.logger("video").info("开始执行-快手")
  26. video_type = "音画美文"
  27. channel_type = "kuaishou"
  28. VideoStitching.video_stitching(video_type, ks_yinmei_count, channel_type)
  29. elif int(dy_yinmei_count) < 10:
  30. Common.logger("video").info("开始执行-抖音")
  31. video_type = "音画美文"
  32. channel_type = "douyin"
  33. VideoStitching.video_stitching(video_type, dy_yinmei_count, channel_type)
  34. elif int(koubo_count) < 10:
  35. Common.logger("video").info("开始执行-口播")
  36. video_type = "口播--美文类"
  37. channel_type = "koubo"
  38. VideoStitching.video_stitching(video_type, koubo_count, channel_type)
  39. count = int(dy_yinmei_count + koubo_count + ks_yinmei_count)
  40. if count == 30:
  41. if flag:
  42. Feishu.bot('recommend', '拼接视频', '自制视频拼接完成啦,共计30条~')
  43. flag = False
  44. if count == 0:
  45. flag = True
  46. def job_feishu_bot():
  47. # jieri_count = sql.get_jieri_account_id()
  48. dy_yinmei_count = sql.get_dy_yinmei_account_id()
  49. koubo_count = sql.get_koubo_account_id()
  50. ks_yinmei_count = sql.get_ks_yinmei_account_id()
  51. count = int(dy_yinmei_count + koubo_count + ks_yinmei_count)
  52. if count < 30:
  53. Feishu.bot('recommend', '拼接视频', f'视频生成异常,不符合预期,请检查\n目前生成数量如下:\n抖音视频拼接:{dy_yinmei_count}条 \n快手视频拼接:{ks_yinmei_count}条\n口播视频拼接:{koubo_count}条')
  54. # 每15分钟执行一次
  55. schedule.every(15).minutes.do(job_video_stitching)
  56. # 每天下午1:30执行任务
  57. schedule.every().day.at("13:30").do(job_feishu_bot)
  58. while True:
  59. schedule.run_pending()
  60. time.sleep(1)