Hardware Reference
In-Depth Information
*) # Normal start up of autorun.sh script
for i in $(seq $MOVIE_LOOPS) # Play creepy movie in a loop the
number of times specified
do
prepare_tv
play_movie
tv_off
sleep "$MOVIE_SLEEP" # Sleep the number of seconds specified
done
start_webcam_prank # Begin prank phase 2
;;
esac
Don't forget to give the script executable permission using
chmod +x ~/autorun.sh
.
As you can see, we're starting Motion with a special configuration file for the prank,
called
~/.motion/prank.conf
. This is a copy of your previous single thread
configuration, except for two configuration directives:
on_event_start /home/pi/autorun.sh prankon
on_event_end /home/pi/autorun.sh prankoff
This allows our script to react to the Motion events.
Now all we need to do is adjust
/etc/rc.local
to set a timer for our
autorun.sh
script using the
at
command. Type in
sudo nano /etc/rc.local
to open it up for
editing, and adjust the following block:
if [ -x /home/pi/autorun.sh ]; then
sudo -u pi at now + 9 hours -f /home/pi/autorun.sh
fi
So if you plug in the Pi at your friend's house at 6 P.M., strange things should start
happening right around 3 A.M. in the morning.
As for what creepy movie to play, we leave that entirely up to you. There's a tool
called
youtube-dl
that you might find useful. Install it and update it with the
following sequence of commands:
pi@raspberrypi ~ $ sudo apt-get install youtube-dl
pi@raspberrypi ~ $ sudo wget https://yt-dl.org/latest/youtube-dl -O /usr/
bin/youtube-dl
Now you could use it to fetch videos like this:
pi@raspberrypi ~ $ youtube-dl http://www.youtube.com/
watch?v=[creepyvideoid]