forked from erik-smit/sony-camera-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsony.sh
executable file
·47 lines (42 loc) · 835 Bytes
/
sony.sh
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
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
VERBOSE=
if [ -z "$_resty_host" ]; then
echo "Please set camera URL. Example:"
echo " . resty/resty http://10.0.0.1:10000"
exit
fi
. resty/resty -W
if [ -z "$2" ]; then
echo "Usage:
$0 guide getServiceProtocols"
exit
fi;
INDEX=0
for ARGUMENT in "${@:3}"
do
case $ARGUMENT in
"")
PARAM='""';;
*[^a-zA-Z]* )
PARAM="\"$3";;
*)
PARAM=$3;;
# *[^a-zA-Z0-9-]* ) echo "not ok : special character";exit;;
esac
PARAMS+=`printf "/params/%s=%s\n" "$INDEX" "$PARAM"`
INDEX=$[$INDEX +1]
done
if [ -z "$PARAMS" ]; then
PARAMS="/params=[]"
fi
RESP=`echo '/version="1.0
'$PARAMS'
/method='$2'
/id=1' | json2/2json | tee kees | POST /sony/$1 2>&1`
if [ $VERBOSE ]; then
echo "Request : `cat kees`"
echo "Response: $RESP"
echo
fi
echo $RESP | json2/json2
rm kees