# -*- coding: utf-8 -*- import os import random import sys import datetime sys.path.append(os.getcwd()) from common.feishu_utils import Feishu class Material(): """ 获取汇总表所有负责人列表 """ @classmethod def feishu_list(cls): summary = Feishu.get_values_batch("summary", "3e1295") list = [] for row in summary[1:]: mark = row[0] name = row[1] feishu_id = row[3] feishu_sheet = row[4] pw_sheet = row[5] number = {"mark": mark, "name": name, "feishu_id": feishu_id, "feishu_sheet": feishu_sheet, "pw_sheet": pw_sheet} if mark: list.append(number) else: return list return list """ 获取对应负责人任务明细 """ @classmethod def get_task_data(cls, feishu_id, feishu_sheet): data = Feishu.get_values_batch(feishu_id, feishu_sheet) processed_list = [] for row in data[1:]: old_id = row[1] video_id = row[2] new_id = row[3] number = row[4] video_share = row[5] video_ending = row[6] crop_tool = row[7] gg_duration = row[8] title = row[9] def count_items(item, separator): if item and item not in {'None', ''}: return len(item.split(separator)) return 0 old_id_total = count_items(str(old_id), ',') video_id_total = count_items(str(video_id), ',') new_id_total = count_items(str(new_id), ',') title_total = count_items(str(title), '/') values = [old_id_total, video_id_total, new_id_total, video_share, video_ending, crop_tool, gg_duration, title_total] filtered_values = [str(value) for value in values if value is not None and value != "None"] task_mark = "_".join(map(str, filtered_values)) if new_id and new_id not in {'None', ''}: number_dict = { "task_mark": task_mark, "old_id": old_id, "video_id": video_id, "new_id": new_id, "number": number, "title": title, "video_share": video_share, "video_ending": video_ending, "crop_total": crop_tool, "gg_duration_total": gg_duration, } processed_list.append(number_dict) else: return processed_list return processed_list """ 获取对应负责人下的片尾+固定字幕 """ @classmethod def get_pwsrt_data(cls, feishu_id, feishu_sheet): data = Feishu.get_values_batch(feishu_id, feishu_sheet) list = [] zm_list = [] for row in data[1:]: pw_id = row[0] pw_srt = row[1] zm_video = row[2] if pw_id != 'None' and pw_id != '' and pw_id != None: number = {"pw_id": pw_id, "pw_srt": pw_srt} list.append(number) if zm_video != 'None' and zm_video != '' and zm_video != None: zm_list.append(zm_video) return list, zm_list