zhangyong 8 月之前
父节点
当前提交
dbd0a38596
共有 3 个文件被更改,包括 134 次插入0 次删除
  1. 97 0
      common/feishu_form.py
  2. 2 0
      common/redis.py
  3. 35 0
      video_rewriting/video_processor.py

+ 97 - 0
common/feishu_form.py

@@ -158,6 +158,103 @@ class Material():
         processed_list = cls.sort_keyword_data(processed_list)
         return processed_list
 
+    """
+    获取品类对应负责人任务明细
+    """
+    @classmethod
+    def get_pl_task_data(cls, feishu_id, feishu_sheet):
+        data = Feishu.get_values_batch( feishu_id, feishu_sheet )
+        processed_list = []
+        try:
+            for row in data[1:]:
+                channel_id = row[1]
+                channel_url = str( row[2] )
+                piaoquan_id = row[3]
+                number = row[4]
+                video_share = row[5]
+                video_ending = row[6]
+                voice = row[7]
+                crop_tool = row[8]
+                gg_duration = row[9]
+                title = row[10]
+                if channel_url == None or channel_url == "" or len( channel_url ) == 0:
+                    continue
+                try:
+                    ls_number = int( row[11] )
+                except:
+                    ls_number = None
+                first_category = row[12]
+
+                def count_items(item, separator):
+                    if item and item not in {'None', ''}:
+                        return len( item.split( separator ) )
+                    return 0
+
+                video_id_total = count_items( str( channel_url ), ',' )
+                title_total = count_items( str( title ), '/' )
+                video_ending_total = count_items( str( video_ending ), ',' )
+                values = [channel_id, video_id_total, piaoquan_id, video_share, video_ending_total, 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 piaoquan_id and piaoquan_id not in {'None', ''}:
+                    if ',' in channel_url:
+                        channel_url = channel_url.split( ',' )
+                    else:
+                        channel_url = [channel_url]
+                    for user in channel_url:
+                        number_dict = {
+                            "task_mark": task_mark,
+                            "channel_id": channel_id,
+                            "channel_url": user,
+                            "piaoquan_id": piaoquan_id,
+                            "number": number,
+                            "title": title,
+                            "video_share": video_share,
+                            "video_ending": video_ending,
+                            "crop_total": crop_tool,
+                            "gg_duration_total": gg_duration,
+                            "voice": voice,
+                            "first_category": first_category,  # 一级品类
+                        }
+                        processed_list.append( json.dumps( number_dict, ensure_ascii=False ) )
+                        if channel_id == "抖音" or channel_id == "快手" or channel_id == "视频号":
+                            if ls_number and ls_number not in {'None', ''}:
+                                if channel_id == "抖音":
+                                    new_channel_id = "抖音历史"
+                                if channel_id == "快手":
+                                    new_channel_id = "快手历史"
+                                if channel_id == "视频号":
+                                    new_channel_id = "视频号历史"
+
+                                values1 = [new_channel_id, video_id_total, piaoquan_id, video_share, video_ending_total,
+                                           crop_tool,
+                                           gg_duration, title_total]
+                                filtered_values1 = [str( value ) for value in values1 if
+                                                    value is not None and value != "None"]
+                                task_mark1 = "_".join( map( str, filtered_values1 ) )
+                                number_dict = {
+                                    "task_mark": task_mark1,
+                                    "channel_id": new_channel_id,
+                                    "channel_url": user,
+                                    "piaoquan_id": piaoquan_id,
+                                    "number": ls_number,
+                                    "title": title,
+                                    "video_share": video_share,
+                                    "video_ending": video_ending,
+                                    "crop_total": crop_tool,
+                                    "gg_duration_total": gg_duration,
+                                    "voice": voice,
+                                    "first_category": first_category,  # 一级品类
+                                }
+                                processed_list.append( json.dumps( number_dict, ensure_ascii=False ) )
+                else:
+                    return processed_list
+
+            return processed_list
+        except:
+            return processed_list
+
     """
     获取对应负责人任务明细
     """

+ 2 - 0
common/redis.py

@@ -46,6 +46,8 @@ def get_data(name, feishu_id, feishu_sheet):
             return None
         if name == 'dy-pl-gjc' or name == 'ks-pl-gjc' or name == 'sph-pl-gjc':
             data = Material.get_keyword_data(feishu_id, feishu_sheet)
+        elif name == 'dy-plzh-1' or name == 'dy-plzh' or name == 'sph-plzh'or name == 'ks-plzh':
+            data = Material.get_pl_task_data(feishu_id, feishu_sheet)
         else:
             data = Material.get_task_data(feishu_id, feishu_sheet)
         client.rpush(task, *data)

+ 35 - 0
video_rewriting/video_processor.py

@@ -304,6 +304,41 @@ class VideoProcessor:
                                 pq_url
                             ]
                         ]
+                    elif name == "抖音品类账号-1" or name == "抖音品类账号" or name == "视频号品类账号" or name == "快手品类账号":
+                        first_category = task["first_category"]
+                        tag_first = f"一级品类_{first_category}"
+                        if channel_id == "抖音" or channel_id == "抖音历史":
+                            tag_channel = "来源_抖音品类账号"
+                        elif channel_id == "快手" or channel_id == "快手历史":
+                            tag_channel = "来源_快手品类账号"
+                        elif channel_id == "视频号" or channel_id == "快手历史":
+                            tag_channel = "来源_视频号品类账号"
+                        tag = f"{tag_first},{tag_channel}"
+                        tag_status = Tag.video_tag( code, tag )
+                        if tag_status == 0:
+                            Common.logger(mark).info(f"{name}的{task_mark}下的ID{url}下的票圈视频{code},写入标签成功")
+                        log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice},,first_category:{first_category},,secondary_category:{secondary_category},,keyword_principal:{keyword_principal},,tag:{tag}"
+                        values = [
+                            [
+                                name,
+                                task_mark,
+                                channel_id,
+                                url,
+                                str( v_id ),
+                                piaoquan_id,
+                                old_title,
+                                title if title in ["原标题", "AI标题"] else "",
+                                new_title,
+                                str( code ),
+                                formatted_time,
+                                str( rule ),
+                                explain,
+                                voice,
+                                first_category,
+                                pq_url
+                            ]
+                        ]
+
                     else:
                         log_data = f"user:{url},,video_id:{v_id},,video_url:{video_url},,ai_title:{new_title},,voice:{voice}"
                         values = [