Spaces:
Sleeping
Sleeping
rogerxavier
commited on
Commit
•
a5b527c
1
Parent(s):
17a9165
Update api.py
Browse files
api.py
CHANGED
@@ -112,10 +112,10 @@ async def execute_all_task(background_tasks: BackgroundTasks,file_list: list = [
|
|
112 |
#如果请求中设置允许上传output.mp4
|
113 |
cover_img = cover_image.file.read()
|
114 |
cover_img_data = Image.open(io.BytesIO(img)).convert("L").convert("RGB")
|
115 |
-
|
116 |
-
cover_img_data.save(
|
117 |
#video数据从meta用户请求获取,至于
|
118 |
-
background_tasks.add_task(upload_video, bili_meta_data)
|
119 |
return {"message": "提交video任务已加入队列"}
|
120 |
|
121 |
return {"message": "Tasks added to the queue"}
|
@@ -141,7 +141,7 @@ def returnRandomSubscribeUrl(background_tasks: BackgroundTasks)->str:
|
|
141 |
|
142 |
|
143 |
|
144 |
-
async def upload_video():
|
145 |
credential = Credential(sessdata=sessdata,
|
146 |
bili_jct=bili_jct,
|
147 |
buvid3=buvid3)
|
@@ -149,7 +149,7 @@ async def upload_video():
|
|
149 |
|
150 |
page = video_uploader.VideoUploaderPage(path='mp4_out/output_video.mp4', title=meta['title'], description=meta['desc'])
|
151 |
|
152 |
-
uploader = video_uploader.VideoUploader([page], meta, credential, cover=
|
153 |
|
154 |
@uploader.on("__ALL__")
|
155 |
async def ev(data):
|
|
|
112 |
#如果请求中设置允许上传output.mp4
|
113 |
cover_img = cover_image.file.read()
|
114 |
cover_img_data = Image.open(io.BytesIO(img)).convert("L").convert("RGB")
|
115 |
+
cover_path_to_image = os.path.join(cover_path, f"cover.jpg")
|
116 |
+
cover_img_data.save(cover_path_to_image)
|
117 |
#video数据从meta用户请求获取,至于
|
118 |
+
background_tasks.add_task(upload_video, bili_meta_data,cover_path_to_image)
|
119 |
return {"message": "提交video任务已加入队列"}
|
120 |
|
121 |
return {"message": "Tasks added to the queue"}
|
|
|
141 |
|
142 |
|
143 |
|
144 |
+
async def upload_video(meta:dict,cover_path_to_image:str):
|
145 |
credential = Credential(sessdata=sessdata,
|
146 |
bili_jct=bili_jct,
|
147 |
buvid3=buvid3)
|
|
|
149 |
|
150 |
page = video_uploader.VideoUploaderPage(path='mp4_out/output_video.mp4', title=meta['title'], description=meta['desc'])
|
151 |
|
152 |
+
uploader = video_uploader.VideoUploader([page], meta, credential, cover=cover_path_to_image)
|
153 |
|
154 |
@uploader.on("__ALL__")
|
155 |
async def ev(data):
|