|  | @@ -244,13 +244,13 @@ class VideoStitching():
 | 
	
		
			
				|  |  |          color_clip = editor.ColorClip(size=(final_width, 90),
 | 
	
		
			
				|  |  |                                        color=(255, 255, 0)).set_duration(duration_limit)
 | 
	
		
			
				|  |  |          final_clip = editor.CompositeVideoClip([final_clip, color_clip.set_position(("center", final_height - 80))])
 | 
	
		
			
				|  |  | -        Common.logger().info(f"字幕内容为:{srt}")
 | 
	
		
			
				|  |  | +        Common.logger("video").info(f"字幕内容为:{srt}")
 | 
	
		
			
				|  |  |          if srt != None:
 | 
	
		
			
				|  |  | -            Common.logger().info(f"处理字幕文件")
 | 
	
		
			
				|  |  | +            Common.logger("video").info(f"处理字幕文件")
 | 
	
		
			
				|  |  |              # 使用正则表达式提取时间码和字幕内容
 | 
	
		
			
				|  |  |              pattern = r"(\d{2}:\d{2}:\d{2},\d{3}) --> (\d{2}:\d{2}:\d{2},\d{3})\n([\s\S]+?(?=\n\d|$))"
 | 
	
		
			
				|  |  |              matches = re.findall(pattern, srt)
 | 
	
		
			
				|  |  | -            Common.logger().info(f"字幕{matches}")
 | 
	
		
			
				|  |  | +            Common.logger("video").info(f"字幕{matches}")
 | 
	
		
			
				|  |  |              # 获取字幕
 | 
	
		
			
				|  |  |              subtitle_clips = []
 | 
	
		
			
				|  |  |              for match in matches:
 | 
	
	
		
			
				|  | @@ -260,17 +260,17 @@ class VideoStitching():
 | 
	
		
			
				|  |  |                  text = cls.split_text(text, 10)
 | 
	
		
			
				|  |  |                  # /System/Library/Fonts/Hiragino Sans GB.ttc 本地字体
 | 
	
		
			
				|  |  |                  # /usr/share/fonts/truetype/wqy/wqy-zenhei.ttc 服务器地址
 | 
	
		
			
				|  |  | -                Common.logger().info(f"字幕:{text}")
 | 
	
		
			
				|  |  | +                Common.logger("video").info(f"字幕:{text}")
 | 
	
		
			
				|  |  |                  sub = editor.TextClip(text, font="/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",
 | 
	
		
			
				|  |  |                                        fontsize=18, color="black").set_duration(end - start).set_start(
 | 
	
		
			
				|  |  |                      start).set_position(
 | 
	
		
			
				|  |  |                      ("center", final_height - 60)).set_opacity(0.8)
 | 
	
		
			
				|  |  |                  subtitle_clips.append(sub)
 | 
	
		
			
				|  |  | -            Common.logger().info(f"将字幕添加到视频上")
 | 
	
		
			
				|  |  | +            Common.logger("video").info(f"将字幕添加到视频上")
 | 
	
		
			
				|  |  |              # 将字幕添加到视频上
 | 
	
		
			
				|  |  |              video_with_subtitles = editor.CompositeVideoClip([final_clip] + subtitle_clips)
 | 
	
		
			
				|  |  |          else:
 | 
	
		
			
				|  |  | -            Common.logger().info(f"添加固定字幕")
 | 
	
		
			
				|  |  | +            Common.logger("video").info(f"添加固定字幕")
 | 
	
		
			
				|  |  |              text_clip = (
 | 
	
		
			
				|  |  |                  editor.TextClip("分享、转发给群友", font="/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",
 | 
	
		
			
				|  |  |                                  fontsize=30, color="black").
 | 
	
	
		
			
				|  | @@ -283,10 +283,10 @@ class VideoStitching():
 | 
	
		
			
				|  |  |          # 生成视频
 | 
	
		
			
				|  |  |          video_with_subtitles.write_videofile(output_path, fps=35)
 | 
	
		
			
				|  |  |          if os.path.isfile(output_path):
 | 
	
		
			
				|  |  | -            Common.logger().info("视频生成成功!生成路径为:", output_path)
 | 
	
		
			
				|  |  | +            Common.logger("video").info("视频生成成功!生成路径为:", output_path)
 | 
	
		
			
				|  |  |              return included_videos, video_with_subtitles, clips
 | 
	
		
			
				|  |  |          else:
 | 
	
		
			
				|  |  | -            Common.logger().info("视频生成失败,请检查代码和文件路径。")
 | 
	
		
			
				|  |  | +            Common.logger("video").info("视频生成失败,请检查代码和文件路径。")
 | 
	
		
			
				|  |  |              return "", video_with_subtitles, clips
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -317,7 +317,7 @@ class VideoStitching():
 | 
	
		
			
				|  |  |          try:
 | 
	
		
			
				|  |  |              code = data["code"]
 | 
	
		
			
				|  |  |              if code != 0:
 | 
	
		
			
				|  |  | -                Common.logger().info(
 | 
	
		
			
				|  |  | +                Common.logger("video").info(
 | 
	
		
			
				|  |  |                      f"未登录,请更换cookie,{data}")
 | 
	
		
			
				|  |  |                  Feishu.bot('recommend', '管理后台', '管理后台cookie失效,请及时更换~')
 | 
	
		
			
				|  |  |                  return ""
 | 
	
	
		
			
				|  | @@ -325,7 +325,7 @@ class VideoStitching():
 | 
	
		
			
				|  |  |              print(audio_url)
 | 
	
		
			
				|  |  |              return audio_url
 | 
	
		
			
				|  |  |          except Exception as e:
 | 
	
		
			
				|  |  | -            Common.logger().warning(f"获取音频视频链接失败:{e}\n")
 | 
	
		
			
				|  |  | +            Common.logger("video").warning(f"获取音频视频链接失败:{e}\n")
 | 
	
		
			
				|  |  |              return ""
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @classmethod
 | 
	
	
		
			
				|  | @@ -338,9 +338,9 @@ class VideoStitching():
 | 
	
		
			
				|  |  |              return
 | 
	
		
			
				|  |  |          audio = cls.get_audio_url(audio_id, cookie)
 | 
	
		
			
				|  |  |          if audio == "":
 | 
	
		
			
				|  |  | -            Common.logger().info(f"获取音频地址为空")
 | 
	
		
			
				|  |  | +            Common.logger("video").info(f"获取音频地址为空")
 | 
	
		
			
				|  |  |              return
 | 
	
		
			
				|  |  | -        Common.logger().info(f"获取音频地址:{audio},获取用户id:{audio_id}")
 | 
	
		
			
				|  |  | +        Common.logger("video").info(f"获取音频地址:{audio},获取用户id:{audio_id}")
 | 
	
		
			
				|  |  |          if video_type == "口播--美文类":
 | 
	
		
			
				|  |  |              # 获取已入库的口播视频
 | 
	
		
			
				|  |  |              audio_list = cls.get_audio_list()
 | 
	
	
		
			
				|  | @@ -349,18 +349,18 @@ class VideoStitching():
 | 
	
		
			
				|  |  |              # 判断该视频+音频是否生成过视频
 | 
	
		
			
				|  |  |              video = VideoStitching.get_audio_url_list(videos, audio_id)
 | 
	
		
			
				|  |  |              if video:
 | 
	
		
			
				|  |  | -                Common.logger().info(f"该视频+音频已经生成过视频,不做视频拼接")
 | 
	
		
			
				|  |  | +                Common.logger("video").info(f"该视频+音频已经生成过视频,不做视频拼接")
 | 
	
		
			
				|  |  |                  return
 | 
	
		
			
				|  |  |          else:
 | 
	
		
			
				|  |  |              # 获取已入库的用户id
 | 
	
		
			
				|  |  |              account_id = cls.get_account_id(channel_type)
 | 
	
		
			
				|  |  |              account = random.choice(account_id)
 | 
	
		
			
				|  |  |              account = str(account).replace('(', '').replace(')', '').replace(',', '')
 | 
	
		
			
				|  |  | -            Common.logger().info(f"获取用户ID:{account}")
 | 
	
		
			
				|  |  | +            Common.logger("video").info(f"获取用户ID:{account}")
 | 
	
		
			
				|  |  |              # 获取 未使用的视频链接
 | 
	
		
			
				|  |  |              url_list = cls.get_url_list(audio_id, account)
 | 
	
		
			
				|  |  |              if url_list == None:
 | 
	
		
			
				|  |  | -                Common.logger().info(f"未使用视频链接为空:{url_list}")
 | 
	
		
			
				|  |  | +                Common.logger("video").info(f"未使用视频链接为空:{url_list}")
 | 
	
		
			
				|  |  |                  return
 | 
	
		
			
				|  |  |              videos = [list(item) for item in url_list]
 | 
	
		
			
				|  |  |          videos = Oss.get_oss_url(video_type, videos)
 | 
	
	
		
			
				|  | @@ -368,16 +368,16 @@ class VideoStitching():
 | 
	
		
			
				|  |  |          try:
 | 
	
		
			
				|  |  |              audio_url, video_with_subtitles, clips = cls.concatenate_videos(videos, str(audio), srt, video_type)
 | 
	
		
			
				|  |  |              if len(audio_url) == 0:
 | 
	
		
			
				|  |  | -                Common.logger().info(f"视频生成失败")
 | 
	
		
			
				|  |  | +                Common.logger("video").info(f"视频生成失败")
 | 
	
		
			
				|  |  |              # 随机生成视频id
 | 
	
		
			
				|  |  |              id = cls.random_id()
 | 
	
		
			
				|  |  | -            Common.logger().info(f"生成视频id为:{id}")
 | 
	
		
			
				|  |  | +            Common.logger("video").info(f"生成视频id为:{id}")
 | 
	
		
			
				|  |  |              # 上传 oss
 | 
	
		
			
				|  |  |              oss_object_key = Oss.stitching_sync_upload_oss(output_path, id)
 | 
	
		
			
				|  |  |              status = oss_object_key.get("status")
 | 
	
		
			
				|  |  |              # 获取 oss 视频地址
 | 
	
		
			
				|  |  |              oss_object_key = oss_object_key.get("oss_object_key")
 | 
	
		
			
				|  |  | -            Common.logger().info(f"新拼接视频,oss发送成功,oss地址:{oss_object_key}")
 | 
	
		
			
				|  |  | +            Common.logger("video").info(f"新拼接视频,oss发送成功,oss地址:{oss_object_key}")
 | 
	
		
			
				|  |  |              if status == 200:
 | 
	
		
			
				|  |  |                  time.sleep(10)
 | 
	
		
			
				|  |  |                  # 发送成功 已使用视频存入数据库
 | 
	
	
		
			
				|  | @@ -385,12 +385,12 @@ class VideoStitching():
 | 
	
		
			
				|  |  |                      cls.insert_video_typeAudio(videos[0], audio_id)
 | 
	
		
			
				|  |  |                  else:
 | 
	
		
			
				|  |  |                      cls.insert_videoAudio(audio_url, audio_id, channel_type)
 | 
	
		
			
				|  |  | -                Common.logger().info(f"发送成功 已使用视频存入数据库完成")
 | 
	
		
			
				|  |  | +                Common.logger("video").info(f"发送成功 已使用视频存入数据库完成")
 | 
	
		
			
				|  |  |                  if os.path.isfile(output_path):
 | 
	
		
			
				|  |  |                      os.remove(output_path)
 | 
	
		
			
				|  |  | -                    Common.logger().info(f"文件删除成功{output_path}")
 | 
	
		
			
				|  |  | +                    Common.logger("video").info(f"文件删除成功{output_path}")
 | 
	
		
			
				|  |  |                  else:
 | 
	
		
			
				|  |  | -                    Common.logger().info(f"文件不存在{output_path}")
 | 
	
		
			
				|  |  | +                    Common.logger("video").info(f"文件不存在{output_path}")
 | 
	
		
			
				|  |  |                  if video_type == "口播--美文类":
 | 
	
		
			
				|  |  |                      os.remove("./video_stitching/video_material/koubo.mp4")
 | 
	
		
			
				|  |  |                  else:
 | 
	
	
		
			
				|  | @@ -399,7 +399,7 @@ class VideoStitching():
 | 
	
		
			
				|  |  |                          os.remove(f'./video_stitching/video_material/{filename}.mp4')
 | 
	
		
			
				|  |  |                  piaoquantv = cls.insert_piaoquantv(oss_object_key, title_list, video_type, channel_type)
 | 
	
		
			
				|  |  |                  if piaoquantv:
 | 
	
		
			
				|  |  | -                    Common.logger().info(f"视频添加到对应用户成功")
 | 
	
		
			
				|  |  | +                    Common.logger("video").info(f"视频添加到对应用户成功")
 | 
	
		
			
				|  |  |                      # 关闭视频文件
 | 
	
		
			
				|  |  |                      for clip in clips:
 | 
	
		
			
				|  |  |                          clip.close()
 | 
	
	
		
			
				|  | @@ -407,7 +407,7 @@ class VideoStitching():
 | 
	
		
			
				|  |  |                      video_with_subtitles.close()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          except Exception as e:
 | 
	
		
			
				|  |  | -            Common.logger().warning(f"新拼接视频发送oss失败:{e}\n")
 | 
	
		
			
				|  |  | +            Common.logger("video").warning(f"新拼接视频发送oss失败:{e}\n")
 | 
	
		
			
				|  |  |              return
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |