forked from achaudhry/adhan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayAzaan.sh
More file actions
30 lines (25 loc) · 967 Bytes
/
playAzaan.sh
File metadata and controls
30 lines (25 loc) · 967 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
#!/usr/bin/env bash
if [ $# -lt 1 ]; then
echo "USAGE: $0 [<volume> 1-100] <azaan-audio-path>"
exit 1
fi
vol="$1"
audio_path="$2"
root_dir=`dirname $0`
JSONRPC="http://localhost:9000/jsonrpc.js"
UUID="aa:bb:cc:dd:ee"
# Run before hooks
for hook in $root_dir/before-hooks.d/*; do
#echo "Running before hook: $hook"
$hook
done
# Play Azaan audio
#omxplayer --vol $vol -o local $audio_path
curl -i -X POST -H "Content-Type: application/json" -d '{"id":1,"params":["'$UUID'",["mixer","volume","'$vol'"]],"method":"slim.request"}' $JSONRPC
curl -i -X POST -H "Content-Type: application/json" -d '{"id":1,"method":"slim.request","params":[ "'$UUID'", ["playlist", "play", "'$audio_path'"] ]}' $JSONRPC
#curl -i -X POST -H "Content-Type: application/json" -d '{"id":1,"method":"slim.request","params":[ "'$UUID'", ["'status'","-",1] ]}' $JSONRPC
Run after hooks
for hook in $root_dir/after-hooks.d/*; do
echo "Running after hook: $hook"
$hook
done