总的上传完成后再投稿
This commit is contained in:
parent
5236cad341
commit
c9ceaeca67
@ -35,6 +35,9 @@ def auto_submit_task():
|
|||||||
if len(bili_record_workflow_item.video_clips) == 0:
|
if len(bili_record_workflow_item.video_clips) == 0:
|
||||||
print("[!]Auto Submit Fail: No Video Clips")
|
print("[!]Auto Submit Fail: No Video Clips")
|
||||||
return
|
return
|
||||||
|
bilibili_instance.login()
|
||||||
|
video_title = bili_record_workflow_item.name
|
||||||
|
_future = None
|
||||||
for video_clip in bili_record_workflow_item.video_clips:
|
for video_clip in bili_record_workflow_item.video_clips:
|
||||||
if len(video_clip.danmaku_clips) > 0:
|
if len(video_clip.danmaku_clips) > 0:
|
||||||
print("[+]Workflow:", bili_record_workflow_item.id, "; Video:", video_clip.full_path)
|
print("[+]Workflow:", bili_record_workflow_item.id, "; Video:", video_clip.full_path)
|
||||||
@ -45,24 +48,27 @@ def auto_submit_task():
|
|||||||
video_clip.danmaku_clips[0].full_path,
|
video_clip.danmaku_clips[0].full_path,
|
||||||
*[clip.full_path for clip in video_clip.danmaku_clips[1:]]
|
*[clip.full_path for clip in video_clip.danmaku_clips[1:]]
|
||||||
)
|
)
|
||||||
video_title = bili_record_workflow_item.name
|
|
||||||
clear_item()
|
clear_item()
|
||||||
def _encode_finish_callback(_f: "Future"):
|
def _encode_finish_callback(_f: "Future"):
|
||||||
_result = _f.result()
|
_result = _f.result()
|
||||||
if _result:
|
if _result:
|
||||||
# start uploading
|
# start uploading
|
||||||
bilibili_instance.login()
|
bilibili_instance.pre_upload(
|
||||||
bilibili_instance.upload(
|
|
||||||
parts=[VideoPart(os.path.join(_item['base_path'], _item['file']), _item['file']) for _item in
|
parts=[VideoPart(os.path.join(_item['base_path'], _item['file']), _item['file']) for _item in
|
||||||
_result],
|
_result])
|
||||||
title=video_title,
|
|
||||||
desc=VIDEO_DESC,
|
|
||||||
tid=VIDEO_TID,
|
|
||||||
tag=VIDEO_TAGS,
|
|
||||||
no_reprint=0)
|
|
||||||
_future.add_done_callback(_encode_finish_callback)
|
_future.add_done_callback(_encode_finish_callback)
|
||||||
else:
|
else:
|
||||||
print("[-]Workflow:", bili_record_workflow_item.id, "; Video:", video_clip.full_path, "; No Danmaku")
|
print("[-]Workflow:", bili_record_workflow_item.id, "; Video:", video_clip.full_path, "; No Danmaku")
|
||||||
|
if _future is not None:
|
||||||
|
def _on_upload_finish(_f: "Future"):
|
||||||
|
bilibili_instance.finish_upload(
|
||||||
|
title=video_title,
|
||||||
|
desc=VIDEO_DESC,
|
||||||
|
tid=VIDEO_TID,
|
||||||
|
tag=VIDEO_TAGS,
|
||||||
|
no_reprint=0)
|
||||||
|
bilibili_instance.clear()
|
||||||
|
_future.add_done_callback(_on_upload_finish)
|
||||||
|
|
||||||
|
|
||||||
def clear_item():
|
def clear_item():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user