-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch2.sh
More file actions
36 lines (30 loc) · 921 Bytes
/
launch2.sh
File metadata and controls
36 lines (30 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
set -eu
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
PYTHON_BIN="${PYTHON_BIN:-$SCRIPT_DIR/env/bin/python3}"
if [ ! -x "$PYTHON_BIN" ]; then
PYTHON_BIN="python3"
fi
WAIT_SECONDS="${NETWORK_WAIT_SECONDS:-30}"
READY_IP=""
while [ "$WAIT_SECONDS" -gt 0 ]; do
READY_IP="$(ip -4 -o addr show dev eth0 2>/dev/null | awk '{print $4}' | cut -d/ -f1 | head -n1)"
if [ -n "$READY_IP" ]; then
break
fi
sleep 1
WAIT_SECONDS=$((WAIT_SECONDS - 1))
done
# Allow explicit pinning; otherwise use eth0 IPv4 when available.
if [ -n "${WRECORDER_STREAMER_IP:-}" ]; then
export WRECORDER_STREAMER_IP
elif [ -n "$READY_IP" ]; then
export WRECORDER_STREAMER_IP="$READY_IP"
fi
"$PYTHON_BIN" -u "$SCRIPT_DIR/camera_streamer.py" \
--base-port 5555 \
--streamer-name cam-pi-2 \
--auto-find-cameras on \
--jpg-quality 20 \
--target-fps 30 \
--grayscale on