Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
if [[ $1 = "start" ]]
then
echo 'on 5' | cec-client -s -d 1
echo 'as' | cec-client -s -d 1
play /home/pi/output.mp3 > /dev/null 2>&1 &
elif [[ $1 = "stop" ]]
then
killall play
echo 'standby 5' | cec-client -s -d 1
elif [[ $1 = "status" ]]
then
status=$(echo 'pow 5' | cec-client -s -d 1 | grep "power status:")
if [[ $status == *standby* ]]
then
printf "off"
elif [[ $status == *on* ]]
then
printf "on"
fi
else
echo "invalid argument"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.