| 
														
															@@ -7,13 +7,16 @@ import time 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import threading 
														 | 
														
														 | 
														
															 import threading 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 from common import Material, Common, Feishu 
														 | 
														
														 | 
														
															 from common import Material, Common, Feishu 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 from video_agc.agc_video_method import AgcVidoe 
														 | 
														
														 | 
														
															 from video_agc.agc_video_method import AgcVidoe 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # 控制读写速度的参数 
														 | 
														
														 | 
														
															 # 控制读写速度的参数 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 MAX_BPS = 1 * 1024 * 1024  # 120MB/s 
														 | 
														
														 | 
														
															 MAX_BPS = 1 * 1024 * 1024  # 120MB/s 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+MAX_WORKERS = os.cpu_count() # 线程池最大工作线程数量 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+READ_WRITE_CHUNK_SIZE = 512 * 1024  # 每次读写的块大小 (1MB) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间 
														 | 
														
														 | 
														
															 SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # 全局锁,用于同步读写操作 
														 | 
														
														 | 
														
															 # 全局锁,用于同步读写操作 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 lock = threading.Lock() 
														 | 
														
														 | 
														
															 lock = threading.Lock() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # 记录今天已经返回的用户名 
														 | 
														
														 | 
														
															 # 记录今天已经返回的用户名 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 gs_today = [] 
														 | 
														
														 | 
														
															 gs_today = [] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 cg_today = [] 
														 | 
														
														 | 
														
															 cg_today = [] 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -46,7 +49,6 @@ def gs_video_start(user_data): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if all_count >= int(zd_count): 
														 | 
														
														 | 
														
															             if all_count >= int(zd_count): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 Feishu.bot('recommend', 'AGC完成通知', '今日脚本跟随视频拼接任务完成啦~', user_data_mark.split("-")[0], mark_name) 
														 | 
														
														 | 
														
															                 Feishu.bot('recommend', 'AGC完成通知', '今日脚本跟随视频拼接任务完成啦~', user_data_mark.split("-")[0], mark_name) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 def cg_video_start(user_data): 
														 | 
														
														 | 
														
															 def cg_video_start(user_data): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     global cg_today 
														 | 
														
														 | 
														
															     global cg_today 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     user_data_mark = user_data["mark"] 
														 | 
														
														 | 
														
															     user_data_mark = user_data["mark"] 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -90,8 +92,6 @@ def controlled_io_operation(platform, data): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     elif platform == "bk": 
														 | 
														
														 | 
														
															     elif platform == "bk": 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         bk_video_start(data) 
														 | 
														
														 | 
														
															         bk_video_start(data) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 def video_start(platform): 
														 | 
														
														 | 
														
															 def video_start(platform): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     print("开始执行生成视频脚本.") 
														 | 
														
														 | 
														
															     print("开始执行生成视频脚本.") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if platform == "cg": 
														 | 
														
														 | 
														
															     if platform == "cg": 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -102,7 +102,8 @@ def video_start(platform): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         data = Material.feishu_bk_list() 
														 | 
														
														 | 
														
															         data = Material.feishu_bk_list() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor: 
														 | 
														
														 | 
														
															     with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         futures = {executor.submit(controlled_io_operation, platform, user_data): user_data for user_data in data} 
														 | 
														
														 | 
														
															         futures = {executor.submit(controlled_io_operation, platform, user_data): user_data for user_data in data} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        for future in concurrent.futures.as_completed(futures): 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        timeout = 20 * 60  # 设置超时时间为20分钟 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        for future in concurrent.futures.as_completed(futures, timeout=timeout): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             try: 
														 | 
														
														 | 
														
															             try: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 future.result() 
														 | 
														
														 | 
														
															                 future.result() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 print("处理结果: 成功") 
														 | 
														
														 | 
														
															                 print("处理结果: 成功") 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -124,19 +125,17 @@ def bk_usernames_today(): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # 定时任务设置 
														 | 
														
														 | 
														
															 # 定时任务设置 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 schedule.every().day.at("00:10").do(gs_usernames_today) 
														 | 
														
														 | 
														
															 schedule.every().day.at("00:10").do(gs_usernames_today) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 schedule.every().day.at("04:10").do(cg_usernames_today) 
														 | 
														
														 | 
														
															 schedule.every().day.at("04:10").do(cg_usernames_today) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 schedule.every().day.at("19:10").do(bk_usernames_today) 
														 | 
														
														 | 
														
															 schedule.every().day.at("19:10").do(bk_usernames_today) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 schedule.every(10).minutes.do(video_start, "cg") 
														 | 
														
														 | 
														
															 schedule.every(10).minutes.do(video_start, "cg") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 schedule.every(10).minutes.do(video_start, "gs") 
														 | 
														
														 | 
														
															 schedule.every(10).minutes.do(video_start, "gs") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 schedule.every(10).minutes.do(video_start, "bk") 
														 | 
														
														 | 
														
															 schedule.every(10).minutes.do(video_start, "bk") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 if __name__ == "__main__": 
														 | 
														
														 | 
														
															 if __name__ == "__main__": 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     while True: 
														 | 
														
														 | 
														
															     while True: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        schedule.run_pending() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        try: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            schedule.run_pending() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        except Exception as e: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            print("执行调度任务时出现异常:", e) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         time.sleep(1) 
														 | 
														
														 | 
														
															         time.sleep(1) 
														 |