| 
					
				 | 
			
			
				@@ -183,19 +183,17 @@ class VideoStitching(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       color=(255, 255, 0)).set_duration(duration_limit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         final_clip = editor.CompositeVideoClip([final_clip, color_clip.set_position(("center", final_height - 70))]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if srt != None: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Common.logger().info(f"处理SRT字幕文件") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Common.logger().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}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            # 从SRT字幕文件中获取字幕 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            # 获取字幕 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             subtitle_clips = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for match in matches: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                start = match[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                start = cls.srt_to_seconds(start) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                end = match[1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                end = cls.srt_to_seconds(end) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                start = cls.srt_to_seconds(match[0]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 start = editor.cvsecs(start) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                end = cls.srt_to_seconds(match[1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 end = editor.cvsecs(end) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 text = match[2].strip() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 text = cls.split_text(text, 10) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -211,6 +209,7 @@ class VideoStitching(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             # 将字幕添加到视频上 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             video_with_subtitles = editor.CompositeVideoClip([final_clip] + subtitle_clips) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Common.logger().info(f"添加固定字幕") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             text_clip = ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 editor.TextClip("分享、转发给群友", font="/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 fontsize=30, color="black"). 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -221,7 +220,7 @@ class VideoStitching(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             # 把 `文本剪贴板` 贴在视频上 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             video_with_subtitles = editor.CompositeVideoClip([final_clip, text_clip]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # 生成视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        video_with_subtitles.write_videofile(output_path, codec='libx264', fps=24) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        video_with_subtitles.write_videofile(output_path,fps=24) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if os.path.isfile(output_path): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Common.logger().info("视频生成成功!生成路径为:", output_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return included_videos, video_with_subtitles 
			 |