feishu_form.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # -*- coding: utf-8 -*-
  2. import json
  3. import os
  4. import sys
  5. from utils.feishu_utils import Feishu
  6. sys.path.append(os.getcwd())
  7. class Material():
  8. """
  9. 获取品类对应负责人任务明细
  10. """
  11. @classmethod
  12. def get_carry_data(cls, dt, FS_SHEET,NAME):
  13. data = Feishu.get_values_batch( "Wj0TsRKc0hZrHQtmtg4cZZIwn0c", FS_SHEET )
  14. processed_list = []
  15. try:
  16. for row in data[2:]:
  17. activate_data = row[4] # 启动日期
  18. if not activate_data:
  19. continue
  20. if int(activate_data) != int(dt):
  21. continue
  22. channel_mark = row[0]
  23. pq_ids = row[2]
  24. pq_label = row[3] # 站内标签
  25. video_url = row[5]
  26. title_category = row[6] #标题类别
  27. tag_transport_channel = row[7] # 搬运平台
  28. tag_transport_scene = row[8] # 搬运场景
  29. tag_transport_keyword = row[9] # 关键词
  30. tag = row[10] # 标签
  31. transform_rule = row[11] # 改造规则
  32. video_share = row[12] # 片中分享
  33. trailer_share = row[13] # 片尾分享
  34. trailer_share_video = row[14] # 片尾手动视频
  35. trailer_share_audio = row[15] # 片尾分享声音
  36. trailer_share_bgm = row[16] # 片尾分享bgm
  37. video_clipping = row[17] # 剪裁
  38. video_clipping_time = row[18] # 秒数剪裁
  39. title_transform = row[19] # 标题改造
  40. if not video_url:
  41. continue
  42. number_dict = {
  43. "channel_mark": channel_mark,
  44. "name":NAME,
  45. "pq_ids": pq_ids,
  46. "pq_label": pq_label,
  47. "activate_data": activate_data,
  48. "video_url": video_url,
  49. "title_category": title_category,
  50. "tag_transport_channel": tag_transport_channel,
  51. "tag_transport_scene": tag_transport_scene,
  52. "tag_transport_keyword": tag_transport_keyword,
  53. "tag": tag,
  54. "transform_rule": transform_rule,
  55. "video_share": video_share,
  56. "trailer_share": str(trailer_share),
  57. "trailer_share_video": trailer_share_video,
  58. "trailer_share_audio": trailer_share_audio,
  59. "video_clipping": video_clipping,
  60. "video_clipping_time": video_clipping_time,
  61. "title_transform": title_transform,
  62. "trailer_share_bgm": str(trailer_share_bgm),
  63. "dt":dt
  64. }
  65. processed_list.append(json.dumps(number_dict, ensure_ascii=False))
  66. return processed_list
  67. except:
  68. return processed_list
  69. @classmethod
  70. def get_propmt_data(cls, trailer_share):
  71. try:
  72. if "AI片尾引导" not in trailer_share:
  73. trailer_share = "AI片尾引导"
  74. data = Feishu.get_values_batch( "Wj0TsRKc0hZrHQtmtg4cZZIwn0c", "Yxg7EK" )
  75. for row in data[1:]:
  76. name = row[0]
  77. if trailer_share == name:
  78. return row[1]
  79. return
  80. except:
  81. return None