Instructables

Pandora's Box - An Internet Radio player made with a Raspberry Pi!

FeaturedContest WinnerContest Winner

Step 4: Setting up the fifo

The fifo lets a script send commands to Pianobar. This is useful for sending button-based commands from a BASH script. In the last step, we configured Pianobar to look in the /home/pi/.config/pianobar directory for a fifo named “ctl”, which still needs to be created. In LXTerminal, the following command makes a fifo:

mkfifo /home/pi/.config/pianobar/ctl

To test that everything is working correctly, restart Pianobar. In another terminal window, enter:

echo 'n' >> /home/pi/.config/pianobar/ctl 

This should change the song being played by Pianobar. If so, we are now able to control it from another terminal (and by extension, a BASH script). All of the commands from Pianobar can work this way - and some interesting combinations can be made. Try “))))))” to increase the volume a lot at one time, or check out the difference between “s” and “s2”. Experimenting with this now will help our scripts make sense later.