Skip to content

Commit 4bcc24c

Browse files
authored
general update
set volume, set mp3 file path with curl
1 parent 473c558 commit 4bcc24c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

playAzaan.sh

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
#!/usr/bin/env bash
22
if [ $# -lt 1 ]; then
3-
echo "USAGE: $0 <azaan-audio-path> [<volume>]"
3+
echo "USAGE: $0 [<volume> 1-100] <azaan-audio-path>"
44
exit 1
55
fi
66

7-
audio_path="$1"
8-
vol=${2:-0}
7+
vol="$1"
8+
audio_path="$2"
99
root_dir=`dirname $0`
10+
JSONRPC="http://localhost:9000/jsonrpc.js"
11+
UUID="aa:bb:cc:dd:ee"
1012

1113
# Run before hooks
1214
for hook in $root_dir/before-hooks.d/*; do
13-
echo "Running before hook: $hook"
15+
#echo "Running before hook: $hook"
1416
$hook
1517
done
1618

1719
# Play Azaan audio
1820
#omxplayer --vol $vol -o local $audio_path
19-
curl -d '{"id":0,"params":["aa:aa:00:00:00:00",["mixer","volume",$vol]],"method":"slim.request"}' http://localhost:9000/jsonrpc.js
20-
curl -d '{"id":0,"params":["aa:aa:00:00:00:00",["playlist","play","$audio_path"]],"method":"slim.request"}' http://localhost:9000/jsonrpc.js
21+
curl -i -X POST -H "Content-Type: application/json" -d '{"id":1,"params":["'$UUID'",["mixer","volume","'$vol'"]],"method":"slim.request"}' $JSONRPC
22+
curl -i -X POST -H "Content-Type: application/json" -d '{"id":1,"method":"slim.request","params":[ "'$UUID'", ["playlist", "play", "'$audio_path'"] ]}' $JSONRPC
23+
#curl -i -X POST -H "Content-Type: application/json" -d '{"id":1,"method":"slim.request","params":[ "'$UUID'", ["'status'","-",1] ]}' $JSONRPC
2124

2225

23-
24-
# Run after hooks
26+
Run after hooks
2527
for hook in $root_dir/after-hooks.d/*; do
2628
echo "Running after hook: $hook"
2729
$hook

0 commit comments

Comments
 (0)