HTTPS SSH

omx-control - control tool for omxplayer under Raspberry Pi

omxplayer is a lightweight multimedia player specifically made for the Raspberry Pi. I use it to control radio player over my smartphone. Entry in crontab enables radio streaming every day at 6:30 AM and plays the radio for 4 hours.

This script is rather rough around the edges, so use it at your own risk.

Controls, that you can use: volume up volume down pause/play quit

In fact, you can implement any other control command that works with omxplayer.

How it works

This mini-web app communicates with omxplayer through named pipes. In order to play the audio streaming you need to create following entries in your crontab (crontab -e):

28 6 * * 1-5 /home/pi/mkmypipe.sh
29 6 * * 1-5 timeout 4h omxplayer http://mainstream.radioagora.pl/tuba10-1.mp3 < /tmp/omx.pipe
30 6 * * 1-5 echo -n . > /tmp/omx.pipe

This sequence of commands runs pipe creating script, then (minute later) orders omxplayer to play the stream and accept input from the named pipe and, after another minute, send dot to the named pipe (because, otherwise, omxplayer would not start the playback).

Credits

I used some opensource website template as a base (and the scraped most of it). Unfortunately, right now I don't remember, who was the author of this template.