ソースを参照

优化生成条数

zhangyong 11 ヶ月 前
コミット
117595b5d8
2 ファイル変更16 行追加12 行削除
  1. 1 1
      agc_job_main.py
  2. 15 11
      video_agc/agc_video.py

+ 1 - 1
agc_job_main.py

@@ -9,7 +9,7 @@ from video_agc.agc_video import AGC
 
 # 控制读写速度的参数
 MAX_BPS = 1 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
+MAX_WORKERS = os.cpu_count() * 5  # 线程池最大工作线程数量
 READ_WRITE_CHUNK_SIZE = 512 * 1024  # 每次读写的块大小 (1MB)
 SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
 

+ 15 - 11
video_agc/agc_video.py

@@ -359,8 +359,12 @@ class AGC():
             list_data = cls.get_unique_uid_data(data_list, int(video_count))
         s_path, v_path, video_path_url, v_oss_path = cls.create_folders(mark)
         count = 0
-        for d_list in list_data:
+        while True:
+            if count == len(list_data):
+                break
+        # for d_list in list_data:
             try:
+                d_list = list_data[count]
                 uid = d_list['uid']  # 音频id
                 srt = d_list['text']  # srt
                 cover = d_list['cover']
@@ -456,16 +460,6 @@ class AGC():
                         # 清空所有mp4数据
                     cls.clear_mp4_files(video_path_url)
                     count += 1
-                    current_time = datetime.now()
-                    formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
-                    if platform == "常规":
-                        third_chars = [j[2] for j in video_files]
-                        data = ",".join(third_chars)
-                        user_id = user
-                    else:
-                        user_id = video_id
-                        data = ''
-                    values = [[mark, str(uid), str(user_id), data, title, new_video_id, formatted_time]]
                     if mark_name == "穆新艺":
                         sheet = '50b8a1'
                     elif mark_name == "信欣":
@@ -478,6 +472,16 @@ class AGC():
                         sheet = 'R1jIeT'
                     elif mark_name == "罗情":
                         sheet = 'iuxfAt'
+                    current_time = datetime.now()
+                    formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
+                    if platform == "常规":
+                        third_chars = [j[2] for j in video_files]
+                        data = ",".join(third_chars)
+                        user_id = user
+                    else:
+                        user_id = video_id
+                        data = ''
+                    values = [[mark, str(uid), str(user_id), data, title, new_video_id, formatted_time]]
                     Feishu.insert_columns("LAn9so7E0hxRYht2UMEcK5wpnMj", sheet, "ROWS", 1, 2)
                     random_wait_time = random.uniform(0.5, 2.5)
                     time.sleep(random_wait_time)