Skip to content

Commit b1927c4

Browse files
JLKwongdogi
andauthored
treehouses camera refactor (fixes #2061) (#2064)
Co-authored-by: dogi <dogi@users.noreply.github.com>
1 parent 51beb4b commit b1927c4

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

modules/camera.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ function camera {
6060
if ! grep -q "start_x=1" ${config} ; then
6161
log_and_exit1 "Error: you need to enable AND reboot first in order to take pictures."
6262
fi
63-
case "$2" in
63+
case "$2" in
6464
"")
6565
echo "Camera is recording ${length} seconds of video and storing a time-stamped ${vidtype} video in ${viddir}."
6666
let length=$length*1000
6767
raspivid -o "${viddir}$BASENAME-${timestamp}.h264" -t "${length}" && echo "Success: Video captured" && echo "Converting video to ${vidtype}"
6868
convert ${viddir}$BASENAME-${timestamp}.h264 ${viddir}$BASENAME-${timestamp}.${vidtype}
6969
rm ${viddir}$BASENAME-${timestamp}.h264
70-
;;
71-
70+
;;
71+
7272
*)
7373
if ! [[ "$2" =~ ^[1-9][0-9]*$ ]] ; then #^[0-9]+$ to accept 0 for indefinite recording
7474
log_and_exit1 "Error: positive integers only."
75-
else
75+
else
7676
echo "Camera is recording ${2} seconds of video and storing a time-stamped ${vidtype} video in ${viddir}."
7777
let length=$2*1000
7878
raspivid -o "${viddir}$BASENAME-${timestamp}.h264" -t "${length}" && echo "Success: Video captured" && echo "Converting video to ${vidtype}"
@@ -82,7 +82,7 @@ function camera {
8282
;;
8383
esac
8484
;;
85-
85+
8686
"detect")
8787
mkdir -p ${directory}
8888
if ! grep -q "start_x=1" ${config} ; then
@@ -113,7 +113,8 @@ function camera {
113113
fi
114114
;;
115115

116-
"*")
116+
*)
117+
echo "Error: The only supported options are 'on', 'off', 'detect, 'capture', and 'record'."
117118
camera_help
118119
;;
119120
esac

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@treehouses/cli",
3-
"version": "1.25.12",
3+
"version": "1.25.13",
44
"remote": "4000",
55
"description": "Thin command-line interface for Raspberry Pi low level configuration.",
66
"main": "cli.sh",

0 commit comments

Comments
 (0)