|
@@ -18,6 +18,7 @@ def get_video_id():
|
|
|
return list( video_ids )
|
|
|
|
|
|
|
|
|
+
|
|
|
def process_video_cover(video_id):
|
|
|
try:
|
|
|
CoverMethod.cover_method( int( video_id ) )
|
|
@@ -28,14 +29,19 @@ def process_video_cover(video_id):
|
|
|
def video_cover_task_start():
|
|
|
with ThreadPoolExecutor( max_workers=max_workers) as executor:
|
|
|
while True:
|
|
|
- video_ids = get_video_id()
|
|
|
- if not video_ids:
|
|
|
- print("没有数据等待30秒")
|
|
|
- time.sleep(30)
|
|
|
+ try:
|
|
|
+ video_ids = get_video_id()
|
|
|
+ if not video_ids:
|
|
|
+ print("没有数据等待30秒")
|
|
|
+ time.sleep(30)
|
|
|
+ continue
|
|
|
+ # 提交所有任务并等待完成
|
|
|
+ futures = [executor.submit( process_video_cover, video_id ) for video_id in video_ids]
|
|
|
+ wait( futures ) # 等待所有任务完成
|
|
|
+ except Exception as e:
|
|
|
+ print(f"异常信息{e}")
|
|
|
+ time.sleep(3)
|
|
|
continue
|
|
|
- # 提交所有任务并等待完成
|
|
|
- futures = [executor.submit( process_video_cover, video_id ) for video_id in video_ids]
|
|
|
- wait( futures ) # 等待所有任务完成
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|