This commit is contained in:
lvtomatoj 2024-01-24 19:40:13 +08:00
parent b5320c01e2
commit 1972936f00

View File

@ -251,21 +251,22 @@ def get_img():
@api.route('/api/video/<path:videoPath>', methods=["GET", 'POST'])
def get_video(videoPath):
# savePath = request.args.get("savePath")
# savePath = request.json.get("savePath", savePath)
savePath = "video/" + videoPath # 这个是从url中获取的
savePath = os.path.join('video',videoPath) # 这个是从url中获取的
wx_path = read_session(g.sf, "wx_path")
video_path = os.path.join(wx_path, videoPath)
if not savePath:
if os.path.exists(savePath):
return send_file(savePath)
if not videoPath:
return ReJson(1002)
# 判断savePath路径的文件夹是否存在
savePath = os.path.join(g.tmp_path, savePath)
if not os.path.exists(os.path.dirname(savePath)):
os.makedirs(os.path.dirname(savePath))
try:
shutil.copy(video_path, savePath)
except PermissionError:
if not os.path.exists(savePath):
return ReJson(5002)
return send_file(savePath)
@api.route('/api/audio/<path:savePath>', methods=["GET", 'POST'])