- First, burn a SD card with the apropriate Debian Image the last recommanded one)
- Activate the SSH by adding an empty file named SSH in the root of the SD card
- Setup the Pi to work on your network (plug a cable or configure the wifi using the GUI)
- Connect any kind of speaker
- Connect to the board using a SSH client (putty) (You can get your device IP by searching in your router's admin pages)
- Use the default Login/PWD to acces (promise to yourself that you will change the password some day)
- Create the script file
cd /home/pi/Documents sudo nano 7-9_player.sh
- In the file type (or copy/paste the following code)
DATE=`date +%d.%m.%Y` cd /home/pi/Documents/ rm rss_10241.xml wget http://radiofrance-podcast.net/podcast09/rss_10241.xml FILENAME_PATTERN="10241-"$DATE"-ITEMA_[[:alnum:]]*-[[:alnum:]]*.mp3" PATTERN="http://media.radiofrance-podcast.net/podcast09/10241-"$DATE"-ITEMA_[[:alnum:]]*-[[:alnum:]]*.mp3" MP3_ADDRESS=`grep $PATTERN rss_10241.xml -o` FILNAME=`grep $FILENAME_PATTERN rss_10241.xml -o` wget $MP3_ADDRESS heure=`date +%H` while [ $heure -lt 9 ] do #echo "waiting hour" heure=`date +%H` done minute=`date +%M` while [ $minute -lt 30 ] do #echo "waiting minute" heure=`date +%M` done echo "running" omxplayer $FILNAME rm rss_10241.xml rm $FILNAME
Note that the wake up time is set in UTC, Kourou is in the UTC-3, which means that I want to wake up at 6:30
- Type CTRL+X then Y to save and quit
- Gives the execution write to the file
sudo chmod 777 7-9_player.sh
- Edit the scheduled task to start the scipt every morning (at least 30min before the wake up time, the internet could be slow)
sudo crontab -e
- Add the following line then save and quit
0 9 * * * /home/pi/Documents/7-9_player.shNote that the pi time is UTC.
My radio program ends at 9 Paris time which means 8UTC in winter and 7UTC in summer, I think the podcast is available within the hour, so I start the script at 9UTC.
- Everything is setup, it should work in the morning.