feishu_form.py 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. number_dict = {
  41. "channel_mark": channel_mark,
  42. "name":NAME,
  43. "pq_ids": pq_ids,
  44. "pq_label": pq_label,
  45. "activate_data": activate_data,
  46. "video_url": video_url,
  47. "title_category": title_category,
  48. "tag_transport_channel": tag_transport_channel,
  49. "tag_transport_scene": tag_transport_scene,
  50. "tag_transport_keyword": tag_transport_keyword,
  51. "tag": tag,
  52. "transform_rule": transform_rule,
  53. "video_share": video_share,
  54. "trailer_share": str(trailer_share),
  55. "trailer_share_video": trailer_share_video,
  56. "trailer_share_audio": trailer_share_audio,
  57. "video_clipping": video_clipping,
  58. "video_clipping_time": video_clipping_time,
  59. "title_transform": title_transform,
  60. "trailer_share_bgm": str(trailer_share_bgm),
  61. "dt":dt
  62. }
  63. processed_list.append(json.dumps(number_dict, ensure_ascii=False))
  64. return processed_list
  65. except:
  66. return processed_list
  67. @classmethod
  68. def get_propmt_data(cls, trailer_share):
  69. try:
  70. if "AI片尾引导" not in trailer_share:
  71. trailer_share = "AI片尾引导"
  72. data = Feishu.get_values_batch( "Wj0TsRKc0hZrHQtmtg4cZZIwn0c", "Yxg7EK" )
  73. for row in data[1:]:
  74. name = row[0]
  75. if trailer_share == name:
  76. return row[1]
  77. return
  78. except:
  79. return None