Getting stream info from MPlayer
Goal: To get the trackinfo from an internet radio stream onto a LCD.
The first step:
To get MPlayer to write to a file we use this command:
>mplayer -playlist http://www.chronixradio.com/chronixaggression/listen/listen.pls 2>&1|tee /var/log/mplayer.log
We can look at the file:
>cat mplayer.log|grep "ICY"
ICY Info: StreamTitle='Opeth - Blackwater Park';StreamUrl='www.opeth.com';
But we get extra info we don't want.
A PHP-script and a regular expression fixes this:
>php mplayerinfo.php
Opeth - Blackwater Park
Another version of the scripts also writes info to a file:
The next step is to install perl-LCDd-0.03 from http://www.webbastards.com/projects/, a Perl library to create lcdproc-clients. From the example provided in the sources I built my own script which uses the information from var/run/nowplaying used above and puts the last row on the LCD. Nice, the goal is reached!