main.py 3.1 KB

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