Hardware Reference
In-Depth Information
WEBCAM_PRANK="y" # Set to y to enable the motion detection prank
tv_off() {
if [ "$(echo "pow 0" | cec-client -d 1 -s | grep 'power status:
on')" ]; then # If TV is currently on
echo "standby 0" | cec-client -d 1 -s # Send the standby command
fi
}
prepare_tv() {
tv_off # We switch the TV off and on again to force the
active channel to the Pi
sleep 10 # Give it a few seconds to shut down
echo "on 0" | cec-client -d 1 -s # Now send the on command
sleep 10 # And give the TV another few seconds to wake up
echo "as" | cec-client -d 1 -s # Now set the Pi to be the
active source
}
play_movie() {
if [ -f ~/"$CREEPY_MOVIE" ]; then # Check that the creepy movie
file exists
omxplayer -o hdmi ~/"$CREEPY_MOVIE" # Then play it with sound
going out through HDMI
fi
}
start_webcam_prank() {
if [ "$WEBCAM_PRANK" = "y" ]; then # Continue only if we have
enabled the webcam prank
mjpg_streamer -b -i "input_uvc.so -r 640x480 -f 30" -o "output_
http.so -w /usr/www" # Start our webcam stream
motion -c ~/.motion/prank.conf # Start up motion with our special
prank configuration file
fi
}
case "$1" in
prankon) # Signal from Motion that event has started
prepare_tv
play_movie
tv_off
;;
prankoff) # Signal from Motion that event has ended
;;
 
Search WWH ::




Custom Search