zhangyong 8 ماه پیش
والد
کامیت
b4ba3d1007
14فایلهای تغییر یافته به همراه199 افزوده شده و 742 حذف شده
  1. 3 1
      common/feishu_form.py
  2. 17 66
      job_czz_ks.py
  3. 16 64
      job_dd_sph.py
  4. 1 0
      job_fj.py
  5. 16 58
      job_lq.py
  6. 16 59
      job_lsy.py
  7. 17 59
      job_lt.py
  8. 17 66
      job_pl_dy.py
  9. 16 61
      job_pl_dy_1.py
  10. 16 64
      job_pl_ks.py
  11. 16 67
      job_sph.py
  12. 16 59
      job_wyt.py
  13. 16 58
      job_xx.py
  14. 16 60
      job_yht.py

+ 3 - 1
common/feishu_form.py

@@ -41,7 +41,7 @@ class Material():
         try:
             for row in data[1:]:
                 channel_id = row[1]
-                channel_url = row[2]
+                channel_url = str(row[2])
                 piaoquan_id = row[3]
                 number = row[4]
                 video_share = row[5]
@@ -49,6 +49,8 @@ class Material():
                 crop_tool = row[7]
                 gg_duration = row[8]
                 title = row[9]
+                if channel_url == None or channel_url == "" or len(channel_url) == 0:
+                    continue
                 try:
                     ls_number = int(row[10])
                 except:

+ 17 - 66
job_czz_ks.py

@@ -1,69 +1,20 @@
-import os
-import concurrent.futures
-import schedule
+
 import time
-import threading
 from common import Material
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-
-# data = Material.feishu_list()
-# video_task_start(data[9])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[9]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-
-video_start()
-
-
-# schedule.every(6).hours.do(video_start)
-schedule.every(15).minutes.do(video_start)
-
-
-
-
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[9]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 16 - 64
job_dd_sph.py

@@ -1,68 +1,20 @@
-import os
-import concurrent.futures
 
-import schedule
 import time
-import threading
 from common import Material
-# 控制读写速度的参数
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[12]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-
-video_start()
-
-
-schedule.every(1).hours.do(video_start)
-# schedule.every(20).minutes.do(video_start)
-
-
-
-
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[12]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 1 - 0
job_fj.py

@@ -19,6 +19,7 @@ def video_task_start():
     """处理视频任务,返回用户名并根据结果决定延迟时间"""
     while True:
         try:
+            print("开始执行任务")
             mark = VideoProcessor.main(data)
             print(f"返回用户名: {mark}")
             time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟

+ 16 - 58
job_lq.py

@@ -1,62 +1,20 @@
-import os
-import concurrent.futures
 
-import schedule
 import time
-import threading
 from common import Material
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-# data = Material.feishu_list()
-# video_task_start(data[0])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[4]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-
-video_start()
-schedule.every(6).hours.do(video_start)
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[4]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 16 - 59
job_lsy.py

@@ -1,63 +1,20 @@
-import os
-import concurrent.futures
 
-import schedule
 import time
-import threading
 from common import Material
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-
-# data = Material.feishu_list()
-# video_task_start(data[0])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[6]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-video_start()
-schedule.every(6).hours.do(video_start)
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[6]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 17 - 59
job_lt.py

@@ -1,62 +1,20 @@
-import os
-import concurrent.futures
-import schedule
+
 import time
-import threading
 from common import Material
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-
-# data = Material.feishu_list()
-# video_task_start(data[0])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[2]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-video_start()
-schedule.every(6).hours.do(video_start)
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[2]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 17 - 66
job_pl_dy.py

@@ -1,69 +1,20 @@
-import os
-import concurrent.futures
-import schedule
+
 import time
-import threading
 from common import Material
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-
-# data = Material.feishu_list()
-# video_task_start(data[10])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[10]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-
-video_start()
-
-
-schedule.every(6).hours.do(video_start)
-# schedule.every(20).minutes.do(video_start)
-
-
-
-
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[10]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 16 - 61
job_pl_dy_1.py

@@ -1,65 +1,20 @@
-import os
-import concurrent.futures
 
-import schedule
 import time
-import threading
 from common import Material
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-
-# data = Material.feishu_list()
-# video_task_start(data[5])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[5]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-
-
-video_start()
-schedule.every(6).hours.do(video_start)
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[5]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 16 - 64
job_pl_ks.py

@@ -1,68 +1,20 @@
-import os
-import concurrent.futures
 
-import schedule
 import time
-import threading
 from common import Material
-# 控制读写速度的参数
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[13]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-
-video_start()
-
-
-schedule.every(1).hours.do(video_start)
-# schedule.every(20).minutes.do(video_start)
-
-
-
-
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[13]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 16 - 67
job_sph.py

@@ -1,71 +1,20 @@
-import os
-import concurrent.futures
 
-import schedule
 import time
-import threading
 from common import Material
-# 控制读写速度的参数
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-
-# data = Material.feishu_list()
-# video_task_start(data[9])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[11]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-
-video_start()
-
-
-schedule.every(12).hours.do(video_start)
-# schedule.every(20).minutes.do(video_start)
-
-
-
-
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[11]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 16 - 59
job_wyt.py

@@ -1,63 +1,20 @@
-import os
-import concurrent.futures
 
-import schedule
 import time
-import threading
 from common import Material
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-
-# data = Material.feishu_list()
-# video_task_start(data[0])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[7]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-video_start()
-schedule.every(6).hours.do(video_start)
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[7]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 16 - 58
job_xx.py

@@ -1,62 +1,20 @@
-import os
-import concurrent.futures
 
-import schedule
 import time
-import threading
 from common import Material
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-# data = Material.feishu_list()
-# video_task_start(data[0])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[8]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-video_start()
-schedule.every(6).hours.do(video_start)
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[8]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()

+ 16 - 60
job_yht.py

@@ -1,64 +1,20 @@
-import os
-import concurrent.futures
 
-import schedule
 import time
-import threading
 from common import Material
-# 控制读写速度的参数
-from video_rewriting.video_processor import VideoProcessor
-
-MAX_BPS = 120 * 1024 * 1024  # 120MB/s
-MAX_WORKERS = os.cpu_count() * 2  # 线程池最大工作线程数量
-READ_WRITE_CHUNK_SIZE = 1024 * 1024  # 每次读写的块大小 (1MB)
-SLEEP_INTERVAL = READ_WRITE_CHUNK_SIZE / MAX_BPS  # 控制每次读写的延迟时间
-# 全局锁,用于同步读写操作
-lock = threading.Lock()
-
-
-
-def video_task_start(data):
-    mark = VideoProcessor.main(data)
-    print(f"返回用户名{mark}")
-
-# data = Material.feishu_list()
-# video_task_start(data[0])
-
-
-def controlled_io_operation(data):
-    with lock:
-        start_time = time.time()
-        time.sleep(SLEEP_INTERVAL)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        if elapsed_time < SLEEP_INTERVAL:
-            time.sleep(SLEEP_INTERVAL - elapsed_time)
-    video_task_start(data)
-
-
-
-
-def video_start():
-    print("开始执行生成视频脚本.")
-
-    data = Material.feishu_list()
-    data = data[3]
-    with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
-        futures = {executor.submit(controlled_io_operation, data)}
-        for future in concurrent.futures.as_completed(futures):
-            try:
-                future.result()
-                print("处理结果: 成功")
-            except concurrent.futures.TimeoutError:
-                print("任务超时,已取消.")
-            except Exception as e:
-                print("处理任务时出现异常:", e)
-    print("执行生成视频脚本结束.")
-
-video_start()
-schedule.every(6).hours.do(video_start)
-while True:
-    schedule.run_pending()
-    time.sleep(1)
-
 
+from video_rewriting.video_processor import VideoProcessor
+def video_task_start():
+    """处理视频任务,返回用户名并根据结果决定延迟时间"""
+    data = Material.feishu_list()[3]
+    while True:
+        try:
+            print("开始执行任务")
+            mark = VideoProcessor.main(data)
+            print(f"返回用户名: {mark}")
+            time.sleep(10 if mark else 120)  # 根据 mark 是否为空设置延迟
+        except Exception as e:
+            print("处理任务时出现异常:", e)
+            time.sleep(10)
+            continue
+if __name__ == '__main__':
+    video_task_start()