添加probe方法
This commit is contained in:
parent
9d1bd80c82
commit
0865122c43
@ -18,6 +18,28 @@ def get_video_clip_info(video_clip_id):
|
||||
return jsonify(video_clip.to_json())
|
||||
|
||||
|
||||
@blueprint.post("/probe")
|
||||
def probe_video_duration():
|
||||
payload = request.json
|
||||
base_path = ""
|
||||
if "base_path" in payload:
|
||||
base_path = payload["base_path"]
|
||||
if "file" in payload:
|
||||
if os.path.isabs(payload["file"]):
|
||||
base_path = ""
|
||||
file = payload["file"]
|
||||
else:
|
||||
return error_json_response("provide file first")
|
||||
duration_str = get_video_real_duration(os.path.join(base_path, file))
|
||||
duration = duration_str_to_float(duration_str)
|
||||
return jsonify({
|
||||
"base_path": base_path,
|
||||
"file": file,
|
||||
"duration_str": duration_str,
|
||||
"duration": duration,
|
||||
})
|
||||
|
||||
|
||||
@blueprint.put("/<int:video_clip_id>")
|
||||
def modify_video_clip(video_clip_id):
|
||||
video_clip = VideoClip.query.get(video_clip_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user