I've modified a bit the script mainly to add a volume progress bar at the bottom.
Since I'm not a programmer, they're may be some uglinesses but it seems to do the job.
Code:
#!/usr/bin/perl
# Little edit of original? script from Phantasm4489 on the XBMC Forum
# Adds bottom progress bar for volume and TV Icon
# http://forum.xbmc.org/showthread.php?tid=55696
# see here for details of imon lcd driver output control bits
# http://lcdproc.cvs.sourceforge.net/viewvc/lcdproc/lcdproc/server/drivers/imonlcd.c?view=markup
#
# Sets the "output state" for the device. We use this to control the icons
# around the outside the display. The bits in \c state correspond to the
# icons as follows:
#
# \verbatim
# bit 0 : disc icon (0=off, 1='spin') , if Toprow==4, use CD-animation,
# else use "HDD-recording-animation"
# bit 1,2,3 : top row (0=none, 1=music, 2=movie, 3=photo, 4=CD/DVD, 5=TV, 6=Web,
# 7=News/Weather)
# bit 4,5 : 'speaker' icons (0=off, 1=LR, 2=5.1ch, 3=7.1ch)
# bit 6 : S/PDIF icon
# bit 7 : 'SRC'
# bit 8 : 'FIT'
# bit 9 : 'TV'
# bit 10 : 'HDTV'
# bit 11 : 'SRC1'
# bit 12 : 'SRC2'
# bit 13,14,15: bottom-right icons (0=off, 1=MP3, 2=OGG, 3=WMA, 4=WAV)
# bit 16,17,18: bottom-middle icons (0=off, 1=MPG, 2=AC3, 3=DTS, 4=WMA)
# bit 19,20,21: bottom-left icons (0=off, 1=MPG, 2=DIVX, 3=XVID, 4=WMV)
# bit 22 : 'VOL' (volume)
# bit 23 : 'TIME'
# bit 24 : 'ALARM'
# bit 25 : 'REC' (recording)
# bit 26 : 'REP' (repeat)
# bit 27 : 'SFL' (shuffle)
# bit 28 : Abuse this for progress bars (if set to 1), lower bits represent
# the length (6 bits each: P|6xTP|6xTL|6xBL|6xBP with P = bit 28,
# TP=Top Progress, TL = Top Line, BL = Bottom Line, BP = Bottom Progress).
# If bit 28 is set to 1, lower bits are interpreted as
# lengths; otherwise setting the symbols as usual.
# 0 <= length <= 32, bars extend from left to right.
# length > 32, bars extend from right to left, length is counted
# from 32 up (i.e. 35 means a length of 3).
#
# Remember: There are two kinds of calls!
# With bit 28 set to 1: Set all bars (leaving the symbols as is),
# with bit 28 set to 0: Set the symbols (leaving the bars as is).
# Beware: TODO: May become a race condition, if both calls are executed
# before the display gets updated. Keep this in mind in your
# client-code.
# bit 29 : 'disc-in icon' - half ellipsoid under the disc symbols (0=off, 1=on)
# \endverbatim
#
# \param drvthis Pointer to driver structure.
# \param state This symbols or bars to display.
#
sleep 4; #wait for LCDd on resume from suspend/hibernate
use HTTP::Request::Common;
use LWP::UserAgent;
use IO::Socket;
my $sockres;
my $sock;
$sock = new IO::Socket::INET (PeerAddr => 'localhost', PeerPort => '13666', Proto => 'tcp', );
die "Could not create socket: $!" unless $sock;
print $sock "hello\n";
$sockres = readline $sock;
my $ua = LWP::UserAgent->new;
# Remove tags from html response so that it's ready for parsing
# may be bad if html is used for something else ?
# remove <html> header
$ua->request(GET 'http://localhost:8080/xbmcCmds/xbmcHttp?command=SetResponseFormat(WebHeader;false)');
# remove </html> footer
$ua->request(GET 'http://localhost:8080/xbmcCmds/xbmcHttp?command=SetResponseFormat(WebFooter;false)');
# remove <li> tag
$ua->request(GET 'http://localhost:8080/xbmcCmds/xbmcHttp?command=SetResponseFormat(OpenTag;)');
do
{
my $output = "";
my $outputvol = "";
my $progress = 0;
my $progressvol = 0;
my $icondata = 0;
my $res = $ua->request(GET 'http://localhost:8080/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying');
my $vol = $ua->request(GET 'http://localhost:8080/xbmcCmds/xbmcHttp?command=GetVolume');
if ($res->is_success)
{
$output = $res->content;
#remove html tags
# $output =~ s/<html>//gi;
# $output =~ s/<.html>//gi;
# $output =~ s/<li>//gi;
}
if ($vol->is_success)
{
$outputvol = $vol->content;
#remove html tags
# $outputvol=~ s/<html>//gi;
# $outputvol =~ s/<.html>//gi;
# $outputvol =~ s/<li>//gi;
$progressvol = $outputvol *32 / 100;
}
my @lines = split(/
/, $output);
foreach my $val (@lines)
{
if ($val =~ /.Nothing Playing/i) { $icondata = $icondata | (6<<1) }; #set icon to web if on menu
if ($val =~ /Filename:/i)
{
if ($val =~ /.pvr/i) { $icondata = $icondata | (1<<9) }; #turn on TV icon
if ($val =~ /.mpg/i) { $icondata = $icondata | (1<<19) }; #turn on MPG icon
if ($val =~ /.mpeg/i) { $icondata = $icondata | (1<<19) }; #turn on MPG icon
if ($val =~ /.avi/i) { $icondata = $icondata | (2<<19) }; #turn on DIVX icon
if ($val =~ /.wmv/i) { $icondata = $icondata | (4<<19) }; #turn on WMV icon
if ($val =~ /.wma/i) { $icondata = $icondata | (3<<13) }; #turn on WMA icon
if ($val =~ /.mp3/i) { $icondata = $icondata | (1<<13) }; #turn on MP3 icon
if ($val =~ /.ogg/i) { $icondata = $icondata | (2<<13) }; #turn on OGG icon
if ($val =~ /.wav/i) { $icondata = $icondata | (4<<13) }; #turn on WAV icon
}
if ($val =~ /Type:/i)
{
if ($val =~ /Video/i) { $icondata = $icondata | (2<<1) }; #turn on MOVIE icon
if ($val =~ /Video/i) { $icondata = $icondata | 1 }; # enable play animation
if ($val =~ /Audio/i) { $icondata = $icondata | (1<<1) }; # turn on MUSIC icon
if ($val =~ /Audio/i) { $icondata = $icondata | 1 }; # enable play animation
if ($val =~ /Picture/i) { $icondata = $icondata | (3<<1) }; # turn on PHOTO icon
}
if ($val =~ /Percentage:/i)
{
$val =~ s/Percentage://i;
if (($val > 0) && ($val < 101)) { $progress = $val *32 / 100 } else { $progress = 0 };
}
}
# set icons. Bit 28 set to 0
printf $sock "output %i",$icondata;
$sockres = readline $sock;
# configure upper and lower progress bars. Bit 28 set to 1
# set to /0 and 6/ and /12 and 18/ for double(bold) progress bars
# could not find other utility. Freemem ? CPU speed ?
printf $sock "output %i",(($progress <<0) | ($progress <<6) | ($progressvol <<12) |($progressvol <<18) | (1<<28));
$sockres = readline $sock;
sleep 1;
} while 1;
close $sock;