Fix the video_file input variable

This commit is contained in:
deflax 2025-02-06 14:51:43 +00:00
parent e236c1608a
commit 953cb66a15

View file

@ -265,24 +265,24 @@ def database_route():
return jsonify(database) return jsonify(database)
# Images # Images
@app.route("/thumb/<file_name>", methods=['GET']) @app.route("/thumb/<thumb_file>", methods=['GET'])
def thumb_route(file_name): def thumb_route(thumb_file):
reqfile = f'{rec_path}/thumb/{file_name}' reqfile = f'{rec_path}/thumb/{thumb_file}'
if not os.path.exists(reqfile): if not os.path.exists(reqfile):
abort(404) abort(404)
return send_file(reqfile, mimetype='image/png') return send_file(reqfile, mimetype='image/png')
# Video # Video
@app.route("/video/<file_name>", methods=['GET']) @app.route("/video/<video_file>", methods=['GET'])
def video_route(file_name): def video_route(video_file):
video_path = f'{rec_path}/vod/{video_file}' video_path = f'{rec_path}/vod/{video_file}'
if not os.path.exists(reqfile): if not os.path.exists(reqfile):
abort(404) abort(404)
logger_content.warning('[' + client_address(request) + '] stream' + str(video_path)) logger_content.warning('[' + client_address(request) + '] stream' + str(video_path))
return send_file(reqfile, mimetype='video/mp4') return send_file(reqfile, mimetype='video/mp4')
@app.route("/video/download/<file_name>", methods=['GET']) @app.route("/video/download/<video_file>", methods=['GET'])
def video_download_route(file_name): def video_download_route(video_file):
video_path = f'{rec_path}/vod/{video_file}' video_path = f'{rec_path}/vod/{video_file}'
if not os.path.exists(reqfile): if not os.path.exists(reqfile):
abort(404) abort(404)