From d1fcb2f3f40adaa29c1ed6691f2503ebcad86606 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Thu, 8 Dec 2022 13:43:17 -0700 Subject: [PATCH] Fix camera paths --- frigate/http.py | 16 ++++++++++++++-- web/src/routes/System.jsx | 17 ++++++----------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/frigate/http.py b/frigate/http.py index f5e9eaa7a..5a88385a1 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -1091,7 +1091,19 @@ def ffprobe(): {"success": False, "message": f"Path needs to be provided."}, "404" ) - if "," in clean_camera_user_pass(path_param): + if path_param.startswith("camera"): + camera = path_param[7:] + + if camera not in current_app.frigate_config.cameras.keys(): + return jsonify( + {"success": False, "message": f"{camera} is not a valid camera."}, "404" + ) + + paths = map( + lambda input: input.path, + current_app.frigate_config.cameras[camera].ffmpeg.inputs, + ) + elif "," in clean_camera_user_pass(path_param): paths = path_param.split(",") else: paths = [path_param] @@ -1100,7 +1112,7 @@ def ffprobe(): output = [] for path in paths: - ffprobe = ffprobe_stream(path) + ffprobe = ffprobe_stream(path.strip()) output.append( { "return_code": ffprobe.returncode, diff --git a/web/src/routes/System.jsx b/web/src/routes/System.jsx index 7da83102e..9f923bbc7 100644 --- a/web/src/routes/System.jsx +++ b/web/src/routes/System.jsx @@ -40,18 +40,9 @@ export default function System() { } setState({ ...state, showFfprobe: true }); - let paths = ''; - config.cameras[camera].ffmpeg.inputs.forEach((input) => { - if (paths) { - paths += ','; - paths += input.path; - } else { - paths = input.path; - } - }); const response = await axios.get('ffprobe', { params: { - paths, + paths: `camera:${camera}`, }, }); @@ -117,7 +108,11 @@ export default function System() {
Vainfo Output - {state.vainfo != '' ?

{state.vainfo}

: } + {state.vainfo != '' ? ( +

{state.vainfo}

+ ) : ( + + )}