Commit
•
7da9800
1
Parent(s):
5c4b3a4
Update api.py
Browse files
api.py
CHANGED
@@ -109,20 +109,21 @@ async def execute_all_task(background_tasks: BackgroundTasks, file_list: List[st
|
|
109 |
):
|
110 |
print("获取到的用户bili_meta_data是:",bili_meta_data)
|
111 |
|
112 |
-
background_tasks.add_task(process_tasks_and_upload, file_list, bili_meta_data, cover_image, cover_path,background_tasks)
|
113 |
return {"message": "提交成功"}
|
114 |
|
115 |
-
def process_tasks_and_upload(file_list, bili_meta_data, cover_image, cover_path,background_tasks):
|
116 |
|
117 |
tasks = []
|
118 |
for file_name in file_list:
|
119 |
tasks.append(file_executer(file_name))
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
126 |
|
127 |
|
128 |
|
|
|
109 |
):
|
110 |
print("获取到的用户bili_meta_data是:",bili_meta_data)
|
111 |
|
112 |
+
background_tasks.add_task(process_tasks_and_upload, file_list, bili_meta_data, cover_image, cover_path,allow_submit,background_tasks)
|
113 |
return {"message": "提交成功"}
|
114 |
|
115 |
+
def process_tasks_and_upload(file_list, bili_meta_data, cover_image, cover_path,allow_submit,background_tasks):
|
116 |
|
117 |
tasks = []
|
118 |
for file_name in file_list:
|
119 |
tasks.append(file_executer(file_name))
|
120 |
|
121 |
+
if allow_submit:
|
122 |
+
cover_img = cover_image.file.read()
|
123 |
+
cover_img_data = Image.open(io.BytesIO(cover_img)).convert("L").convert("RGB")
|
124 |
+
cover_path_to_image = os.path.join(cover_path, "cover.jpg")
|
125 |
+
cover_img_data.save(cover_path_to_image)
|
126 |
+
background_tasks.add_task(upload_video, bili_meta_data, cover_path_to_image)
|
127 |
|
128 |
|
129 |
|