My MPD web interface in just 383 byte
Posted: Fri Sep 16, 2011 5:43 am
I created a AJAX web interface for MPD. All the logic is inside a javascript file hosted on a remote server, so you only need 383 bytes of diskspace on the router. One index.html file that loads the javascript, and one cgi-bin shell script that forwards mpd commands send by the interface to the mpd process using nc.
I created a demo page to see it in action. It's a simulation, so you can't turn on my radio
http://gerben.algemeenbekend.nl/mpc/
It's not entirely finished, but enough to be usable. When I have more time I will probably add playlist manipulation to it.
The OpenWrt image of Jeff already had a http client running, so you just need to create the following files
/www/index.html
and /www/cgi-bin/mpd (chmod to allow execute)
That is all. Now open your browser and enter http://192.168.1.1 or whatever ip you assigned to the router. It should also work on smartphones. If you use a iPhone you add it to your homescreen and will be almost like an app.
Feel free to ask questions, report bugs (or do feature requests if you ask nicely ).
PS. licensing is WTFPL, except for some of the icons that are GPL.
PS2. I forgot the meta viewport in the html file. The code above is now corrected.
I created a demo page to see it in action. It's a simulation, so you can't turn on my radio
http://gerben.algemeenbekend.nl/mpc/
It's not entirely finished, but enough to be usable. When I have more time I will probably add playlist manipulation to it.
The OpenWrt image of Jeff already had a http client running, so you just need to create the following files
/www/index.html
Code: Select all
<!DOCTYPE html><html><head><title></title><meta name="viewport" content="width=device-width">
<link rel="mpd" href="cgi-bin/mpd">
<body><script src="http://gerben.algemeenbekend.nl/mpc/mpc.js"></script>
Code: Select all
#!/bin/sh
echo "Content-type: text/plain"
echo "Connection: close"
echo ""
read sentcommand
if [ -z "$sentcommand" ];then
exit
fi
echo "$sentcommand" | nc 127.0.0.1 6600
Feel free to ask questions, report bugs (or do feature requests if you ask nicely ).
PS. licensing is WTFPL, except for some of the icons that are GPL.
PS2. I forgot the meta viewport in the html file. The code above is now corrected.