-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitor_librespot_play.sh
27 lines (24 loc) · 1.01 KB
/
monitor_librespot_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
#!/bin/bash
gpiopin=18
echo "$gpiopin" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$gpiopin/direction
while :
do
status=`journalctl -u raspotify.service | grep -o "command=Load\|command=Stop\|command=Pause\|command=Play" | sed '$!d'`
if [ $status = "command=Load" ]
then
echo "1" > /sys/class/gpio/gpio$gpiopin/value
elif [ $status = "command=Stop" ]
then
echo "0" > /sys/class/gpio/gpio$gpiopin/value
elif [ $status = "command=Pause" ]
then
echo "1" > /sys/class/gpio/gpio$gpiopin/value
sleep 1
echo "0" > /sys/class/gpio/gpio$gpiopin/value
sleep 1
elif [ $status = "command=Play" ]
then
echo "1" > /sys/class/gpio/gpio$gpiopin/value
fi
done