From a64e4ab5ddf12ebc0c5118381c6c72b572247e7c Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Tue, 21 Jan 2025 09:25:44 +0700 Subject: [PATCH 1/2] Docker: Video record extract last session from json response Signed-off-by: Viet Nguyen Duc --- Video/video.sh | 4 ++-- Video/video_graphQLQuery.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Video/video.sh b/Video/video.sh index 2901f82b47..ac6724f512 100755 --- a/Video/video.sh +++ b/Video/video.sh @@ -22,11 +22,11 @@ ts_format=${SE_LOG_TIMESTAMP_FORMAT:-"%Y-%m-%d %H:%M:%S,%3N"} process_name="video.recorder" if [ "${SE_VIDEO_RECORD_STANDALONE}" = "true" ]; then - JQ_SESSION_ID_QUERY=".value.nodes[]?.slots[]?.session?.sessionId" + JQ_SESSION_ID_QUERY=".value.nodes[-1]?.slots[-1]?.session?.sessionId" SE_NODE_PORT=${SE_NODE_PORT:-"4444"} NODE_STATUS_ENDPOINT="$(/opt/bin/video_gridUrl.sh)/status" else - JQ_SESSION_ID_QUERY=".[]?.node?.slots | .[0]?.session?.sessionId" + JQ_SESSION_ID_QUERY=".[-1]?.node?.slots | .[-1]?.session?.sessionId" SE_NODE_PORT=${SE_NODE_PORT:-"5555"} NODE_STATUS_ENDPOINT="${SE_SERVER_PROTOCOL}://${DISPLAY_CONTAINER_NAME}:${SE_NODE_PORT}/status" fi diff --git a/Video/video_graphQLQuery.sh b/Video/video_graphQLQuery.sh index a10d99e99c..9723c01f04 100755 --- a/Video/video_graphQLQuery.sh +++ b/Video/video_graphQLQuery.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash max_time=1 -retry_time=3 +retry_time=2 # Define parameters SESSION_ID=$1 From 6fc20a4b75d7387e4902dbf677243edce5f343c6 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Tue, 21 Jan 2025 10:20:07 +0700 Subject: [PATCH 2/2] Stop video when session is interrupted Signed-off-by: Viet Nguyen Duc --- Video/video.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Video/video.sh b/Video/video.sh index ac6724f512..e4cc132ffa 100755 --- a/Video/video.sh +++ b/Video/video.sh @@ -259,7 +259,7 @@ else fi echo "$(date -u +"${ts_format}") [${process_name}] - Video recording started" sleep ${poll_interval} - elif [[ "$session_id" != "$prev_session_id" && "$recording_started" = "true" ]]; then + elif [[ "$recording_started" = "true" && ( "$session_id" != "$prev_session_id" || "$session_id" == "null" || "$session_id" == "" ) ]]; then stop_recording wait_for_file_integrity if [[ $max_recorded_count -gt 0 ]] && [[ $recorded_count -ge $max_recorded_count ]]; then