main.py 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import os
  2. import sys
  3. import oss2
  4. import schedule
  5. import time
  6. sys.path.append(os.getcwd())
  7. from common import Common, Feishu
  8. from video_capture.kuaishou.kuaishou_author.kuaishou_author import kuaishouAuthor
  9. from common.sql_help import sql
  10. from video_stitching.video_stitching import VideoStitching
  11. from video_capture.douyin.douyin_author.douyin_author import douyinAuthor
  12. #
  13. # flag = True
  14. # def job_video_stitching():
  15. # global flag
  16. # dy_yinmei_count = sql.get_dy_yinmei_account_id()
  17. # koubo_count = sql.get_koubo_account_id()
  18. # ks_yinmei_count = sql.get_ks_yinmei_account_id()
  19. # if int(dy_yinmei_count) < 10:
  20. # Common.logger().info("开始执行")
  21. # video_type = "音画美文"
  22. # channel_type = "douyin"
  23. # VideoStitching.video_stitching(video_type, dy_yinmei_count, channel_type)
  24. # elif int(ks_yinmei_count) < 10:
  25. # Common.logger().info("开始执行")
  26. # video_type = "音画美文"
  27. # channel_type = "kuaishou"
  28. # VideoStitching.video_stitching(video_type, ks_yinmei_count, channel_type)
  29. # elif int(koubo_count) < 10:
  30. # Common.logger().info("开始执行")
  31. # video_type = "口播--美文类"
  32. # channel_type = "koubo"
  33. # VideoStitching.video_stitching(video_type, koubo_count, channel_type)
  34. # count = int(dy_yinmei_count + koubo_count + ks_yinmei_count)
  35. # if count == 30:
  36. # if flag:
  37. # Feishu.bot('recommend', '拼接视频', '自制视频拼接完成啦,共计30条~')
  38. # flag = False
  39. # if count == 0:
  40. # flag = True
  41. #
  42. # def job_feishu_bot():
  43. # dy_yinmei_count = sql.get_dy_yinmei_account_id()
  44. # koubo_count = sql.get_koubo_account_id()
  45. # ks_yinmei_count = sql.get_ks_yinmei_account_id()
  46. # count = int(dy_yinmei_count + koubo_count + ks_yinmei_count)
  47. # if count < 30:
  48. # Feishu.bot('recommend', '拼接视频', f'视频生成异常,不符合预期,请检查\n目前生成数量如下:\n抖音视频拼接:{dy_yinmei_count}条 \n快手视频拼接:{ks_yinmei_count}条\n口播视频拼接:{koubo_count}条')
  49. #
  50. # def job_douyin_data():
  51. # douyinAuthor.get_videoList()
  52. #
  53. # def job_kuaishou_data():
  54. # kuaishouAuthor.get_kuaishou_videoList()
  55. #
  56. # # 每5个小时执行一次
  57. # schedule.every(5).hours.do(job_douyin_data)
  58. #
  59. # # 每3个小时执行一次
  60. # schedule.every(3).hours.do(job_kuaishou_data)
  61. #
  62. # # 每15分钟执行一次
  63. # schedule.every(15).minutes.do(job_video_stitching)
  64. #
  65. # # 每天下午1:30执行任务
  66. # schedule.every().day.at("13:30").do(job_feishu_bot)
  67. #
  68. # while True:
  69. # schedule.run_pending()
  70. # time.sleep(1)
  71. OSS_ACCESS_KEY_ID = "LTAIP6x1l3DXfSxm"
  72. OSS_ACCESS_KEY_SECRET = "KbTaM9ars4OX3PMS6Xm7rtxGr1FLon"
  73. OSS_BUCKET_ENDPOINT = "oss-cn-hangzhou-internal.aliyuncs.com"# 内网地址
  74. OSS_BUCKET_NAME = "art-crawler"
  75. koubo_count = 1
  76. video_type = "口播--美文类"
  77. channel_type = "koubo"
  78. auth = oss2.Auth(OSS_ACCESS_KEY_ID, OSS_ACCESS_KEY_SECRET)
  79. bucket = oss2.Bucket(auth, OSS_BUCKET_ENDPOINT, OSS_BUCKET_NAME)
  80. if video_type == "口播--美文类":
  81. bucket.get_object_to_file("koubo/fo1", f'./video_stitching/video_material/koubo.mp4')
  82. print("完成")
  83. # VideoStitching.video_stitching(video_type, koubo_count, channel_type)