Raspberry Radio – Raspberry Pi MPD Web Interface

created April 12, 2016, last updated April 12, 2016.

.
closeThis post was last updated 1 year 7 months 27 days ago, some of the information contained here may no longer be actual and any referenced software versions may have been updated!

Over easter I dug out my old Raspberry Pi which had been gathering dust for the last couple of years and turned it into a headless internet radio player. The radio player part is pretty easy using MPD and MPC ( apt-get install -y mpd mpc ) but I wanted a nifty little web interface for my phone and tablet. There are a couple of 80s internet radio stations I like to listen to (‘cos I’m just an old 80s throwback) and I’m always listening to something and thinking I know who that is but by the time I have opened the radio web site again and checked the playlist the song is finished. So I wanted to have a song history so I could check what was playing. There are a few web interfaces out there, but nothing that did what I wanted so I threw together a player using an existing (old) php class for mpc commands and my all time favourite mobile framework of all time – Framework7.

I incorporated the mpc command class into my own PHP MPD Library running on the PI which lets me use ajax to control and send commands to mpd. Framework 7 is also incorporated into my PHP app framework to render the html. The song history uses memcache and a cron job to get the currently playing station data and cache it. This data is created by my memcache logging library which I originally created to log website visits. I just love coming up with new uses for memcache!

The interface is just designed for Radio station control:

  • Stop / Start
  • Prev / Next
  • Vol Up / Down
  • History
  • Playlist
  • Reload
  • Add url

mprd1

mprd2

Comments