| 
					
				 | 
			
			
				@@ -24,6 +24,8 @@ from utils.piaoquan import PQ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from utils.sql_help import sqlCollect 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from utils.tag_video import Tag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from utils.tts_help import TTS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+from utils.google_ai_studio import GoogleAI 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -125,7 +127,7 @@ class ConsumptionRecommend(object): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def data_handle(cls, data, file_path, redis_name): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    def data_handle(cls, data, file_path, redis_name,studio_key): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         url, original_title, video_id, tag_transport_channel = Dy_KS.get_video_url(data, "效率工具") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if url == "重新处理" or not url: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -227,69 +229,110 @@ class ConsumptionRecommend(object): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     video_path = FFmpeg.video_crop(video_path, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if data["video_clipping_time"]:  # 判断是否需要指定视频时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     video_path = FFmpeg.video_ggduration(video_path, file_path, data["video_clipping_time"]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if str(data['trailer_share']): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    prompt = Material.get_propmt_data(str(data['trailer_share'])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pw_srt_text = GPT4oMini.get_ai_mini_pw(title, prompt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    voice = data['trailer_share_audio'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if voice: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if ',' in voice: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            voices = voice.split(',') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            voices = [voice] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        voice = random.choice(voices) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        voice = "zhifeng_emo" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pw_url = TTS.get_pw_zm(pw_srt_text, voice) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if not pw_url: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        logger.error(f"[处理] 数据片尾获取失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if data['trailer_share'] == "内容分析": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    video_text = GoogleAI.run(studio_key, video_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if not video_text: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.error(f"[处理] 视频内容分析获取内容信息失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                             "改造失败,片尾获取失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                             "改造失败,视频内容分析获取内容信息失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"**失败信息**: 获取片尾失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            f"**失败信息**: 视频内容分析获取内容信息失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    logger.info(f"[处理] 数据片尾获取成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pw_srt = TTS.getSrt(pw_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if not pw_srt: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        logger.error(f"[处理] 数据片尾音频srt获取失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                             "改造失败,片尾音频下载失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"**失败信息**: 片尾音频下载失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                          "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                          "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pw_mp3_path = TTS.download_mp3(pw_url, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if not pw_mp3_path: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        logger.error(f"[处理] 数据片尾音频下载失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.info(f"[处理] 片尾引导-开始获取AI片尾") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pw_srt_text = GPT4oMini.get_content_understanding_pw(video_text) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    prompt = Material.get_propmt_data(str(data['trailer_share'])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pw_srt_text = GPT4oMini.get_ai_mini_pw(title, prompt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                voice = data['trailer_share_audio'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if voice: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if ',' in voice: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        voices = voice.split(',') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        voices = [voice] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    voice = random.choice(voices) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    voice = "zhifeng_emo" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pw_url = TTS.get_pw_zm(pw_srt_text, voice) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if not pw_url: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.error(f"[处理] 数据片尾获取失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                         "改造失败,片尾获取失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**失败信息**: 获取片尾失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.info(f"[处理] 数据片尾获取成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pw_srt = TTS.getSrt(pw_url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if not pw_srt: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.error(f"[处理] 数据片尾音频srt获取失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                         "改造失败,片尾音频下载失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**失败信息**: 片尾音频下载失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pw_mp3_path = TTS.download_mp3(pw_url, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if not pw_mp3_path: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.error(f"[处理] 数据片尾音频下载失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                         "改造失败,片尾音频下载失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**失败信息**: 片尾音频下载失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.info(f"[处理] 数据片尾音频下载成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if str(data['trailer_share_video']) and str(data['trailer_share_video'] ) != "None": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    rg_pw = str(data["trailer_share_video"]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if ',' in rg_pw: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        rg_pw_list = rg_pw.split(',') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        rg_pw_list = [rg_pw] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    rg_pw_url_list = PQ.get_pq_oss(rg_pw_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if not rg_pw_url_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                             "改造失败,片尾音频下载失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                             "无法获取站内视频链接", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"**失败信息**: 片尾音频下载失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            f"**失败信息**: 无法获取站内视频链接\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    logger.info(f"[处理] 数据片尾音频下载成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if "AI片尾引导" in str(data['trailer_share']): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pw_url_duration = FFmpeg.get_http_duration([pw_url]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pw_videos_duration = FFmpeg.get_http_duration(rg_pw_url_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if pw_videos_duration < pw_url_duration: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         jpg_path = FFmpeg.video_png(video_path, file_path)  # 生成视频最后一帧jpg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if not os.path.exists(jpg_path) or os.path.getsize(jpg_path) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             data["transform_rule"] = "仅改造" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -308,112 +351,92 @@ class ConsumptionRecommend(object): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         logger.info(f"[处理] 数据片尾获取最后一帧成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        rg_pw = str(data["trailer_share"]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if ',' in rg_pw: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            rg_pw_list = rg_pw.split(',') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            rg_pw_list = [rg_pw] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        rg_pw_url_list = PQ.get_pq_oss(rg_pw_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if not rg_pw_url_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        rg_pw_url = DownLoad.download_pq_video(file_path, rg_pw_url_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        rg_pw_list = FFmpeg.concatenate_videos(rg_pw_url, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if not os.path.exists(rg_pw_list) or os.path.getsize(rg_pw_list) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            logger.error(f"[处理] 数据片尾拼接失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                 "无法获取站内视频链接", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                 "改造失败,片尾拼接失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                f"**失败信息**: 无法获取站内视频链接\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                f"**失败信息**: 片尾拼接失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        pw_url_duration = FFmpeg.get_http_duration([pw_url]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        pw_videos_duration = FFmpeg.get_http_duration(rg_pw_url_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if pw_videos_duration < pw_url_duration: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            jpg_path = FFmpeg.video_png(video_path, file_path)  # 生成视频最后一帧jpg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if not os.path.exists(jpg_path) or os.path.getsize(jpg_path) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                logger.error(f"[处理] 数据片尾获取最后一帧失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                     "改造失败,获取最后一帧失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    f"**失败信息**: 获取视频最后一帧失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                  "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                  "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            logger.info(f"[处理] 数据片尾获取最后一帧成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            rg_pw_url = DownLoad.download_pq_video(file_path, rg_pw_url_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            rg_pw_list = FFmpeg.concatenate_videos(rg_pw_url, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if not os.path.exists(rg_pw_list) or os.path.getsize(rg_pw_list) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                logger.error(f"[处理] 数据片尾拼接失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                     "改造失败,片尾拼接失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    f"**失败信息**: 片尾拼接失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                  "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                  "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            jpg_path = FFmpeg.video_640(rg_pw_list, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            logger.info(f"[处理] 生成人工片尾成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pw_path = FFmpeg.pw_video(jpg_path, file_path, pw_mp3_path, pw_srt)  # 生成片尾视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if not os.path.exists(pw_path) or os.path.getsize(pw_path) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        logger.error(f"[处理] 数据片尾拼接失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                             "改造失败,片尾拼接失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"**失败信息**: 片尾拼接失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                          "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                          "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        jpg_path = FFmpeg.video_640(rg_pw_list, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.info(f"[处理] 生成人工片尾成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    logger.info(f"[处理] 数据合并开始拼接") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    trailer_share_bgm = data['trailer_share_bgm'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    # trailer_share_bgm = '48594759' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if trailer_share_bgm and trailer_share_bgm != "None": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            logger.info(f"[处理] 获取bgm") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            rg_bgm_list = PQ.get_pq_oss([trailer_share_bgm]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            rg_bgm_url = DownLoad.download_pq_video(file_path, rg_bgm_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            bgm_mp3_path = FFmpeg.get_pw_video_mp3(file_path, rg_bgm_url[0]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            pw_path = FFmpeg.video_add_bgm(pw_path, bgm_mp3_path, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            logger.info(f"[处理] 片尾bgm添加成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            logger.error(f"[处理] 片尾bgm添加失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    video_path = FFmpeg.h_b_video(video_path, pw_path, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    video_path = FFmpeg.single_video(video_path, file_path, data["video_share"]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if not os.path.exists(video_path) or os.path.getsize(video_path) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    jpg_path = FFmpeg.video_png(video_path, file_path)  # 生成视频最后一帧jpg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if not os.path.exists(jpg_path) or os.path.getsize(jpg_path) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        logger.error(f"[处理] 数据添加片中字幕失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.error(f"[处理] 数据片尾获取最后一帧失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                             "改造失败,添加片中字幕失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                             "改造失败,获取最后一帧失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            f"**失败信息**: 视频片中增加字幕失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            f"**失败信息**: 获取视频最后一帧失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    logger.info(f"[处理] 数据添加片中字幕成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.info(f"[处理] 数据片尾获取最后一帧成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pw_path = FFmpeg.pw_video(jpg_path, file_path, pw_mp3_path, pw_srt)  # 生成片尾视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if not os.path.exists(pw_path) or os.path.getsize(pw_path) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.error(f"[处理] 数据片尾拼接失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                         "改造失败,片尾拼接失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**失败信息**: 片尾拼接失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.info(f"[处理] 数据合并开始拼接") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                trailer_share_bgm = data['trailer_share_bgm'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                # trailer_share_bgm = '48594759' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if trailer_share_bgm and trailer_share_bgm != "None": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.info(f"[处理] 获取bgm") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        rg_bgm_list = PQ.get_pq_oss([trailer_share_bgm]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        rg_bgm_url = DownLoad.download_pq_video(file_path, rg_bgm_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        bgm_mp3_path = FFmpeg.get_pw_video_mp3(file_path, rg_bgm_url[0]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        pw_path = FFmpeg.video_add_bgm(pw_path, bgm_mp3_path, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.info(f"[处理] 片尾bgm添加成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.error(f"[处理] 片尾bgm添加失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                video_path = FFmpeg.h_b_video(video_path, pw_path, file_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                video_path = FFmpeg.single_video(video_path, file_path, data["video_share"]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if not os.path.exists(video_path) or os.path.getsize(video_path) == 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    data["transform_rule"] = "仅改造" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    RedisHelper().get_client().rpush(redis_name, json.dumps(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.error(f"[处理] 数据添加片中字幕失败") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    AliyunLogger.logging(data["name"], "效率工具", tag_transport_channel, data["video_url"], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                         "改造失败,添加片中字幕失败", "3001", str(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    text = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**负责人**: {data['name']}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**内容**: {data}\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        f"**失败信息**: 视频片中增加字幕失败\n" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Feishu.finish_bot(text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "https://open.feishu.cn/open-apis/bot/v2/hook/65bc5463-dee9-46d0-bc2d-ec6c49a8f3cd", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      "【 搬运&改造效率工具失败通知 】") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.info(f"[处理] 数据添加片中字幕成功") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 logger.info(f"[处理] 数据开始发送oss") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 oss_object_key = Oss.stitching_sync_upload_oss(video_path, str(uuid.uuid4()))  # 视频发送OSS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 logger.info(f"[处理] 数据发送oss成功") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -454,13 +477,14 @@ class ConsumptionRecommend(object): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # fs_data = '周仙琴,2WIcBU,task:carry_data_redis_zxq' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         fs_data_list = fs_data.split(',') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         redis_name = fs_data_list[2] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studio_key = fs_data_list[3] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         data = RedisHelper().get_client().rpop(name=redis_name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if not data: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             logger.info('[处理] 无待执行的扫描任务') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         data = orjson.loads(data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            cls.data_handle(data, file_path, redis_name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            cls.data_handle(data, file_path, redis_name,studio_key) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for filename in os.listdir(CACHE_DIR): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 # 检查文件名是否包含关键字 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if uid in filename: 
			 |