-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplay.sh
executable file
·50 lines (36 loc) · 1007 Bytes
/
play.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
48
49
50
#!/bin/sh
usage() {
echo "$0 usage : start config.json | stop "
}
start() {
local CONFIG="$1"
local TOP=`cat $CONFIG | jq .path | tr -d [\"]`
local NUM=`cat $CONFIG | jq '.sounds | length'`
i=0
while [ $i -lt $NUM ]
do
local name=`cat $CONFIG | jq .sounds | jq .[$i] | jq .name | tr -d [\"]`
local gap=`cat $CONFIG | jq .sounds | jq .[$i] | jq .gap | tr -d [\"]`
local off=`cat $CONFIG | jq .sounds | jq .[$i] | jq .off | tr -d [\"]`
local vol=`cat $CONFIG | jq .sounds | jq .[$i] | jq .volume | tr -d [\"]`
if [ $off -eq 0 ] ; then
[ -z "$vol" ] && vol="1"
play_single.sh $name $gap $vol &
echo "play name ($name) gap($gap) vol($vol)"
fi
i=`expr $i + 1`
done
}
stop() {
killall play_single.sh ;
killall sleep ;
killall play
}
case "$1" in
"start")
start $2 ;;
"stop")
stop;;
*)
usage;;
esac