Soundgraph iMon LCD - display icons
#61
Ok, I moved it from ~/.xbmc/userdata/imon.pl to ~/.imon.pl

Now when I run
Quote:~/.imon.pl
it looks like it runs, however it just hangs there, it doesn't take me back to a command prompt, and it doesn't activate any icons on my lcd.

I'm running the latest release of XBMC Live
Chase
Image
Reply
#62
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;
Reply
#63
muggi Wrote:hi,

is it possible to pull this in the normal xbmc branchHuh? because i don´t have a pvr or a vdr instalation...


greetz muggi

I ported the patch to the official xbmc master branch. It worked fine for me. Please give it a try:

http://trac.xbmc.org/ticket/8981
http://trac.xbmc.org/attachment/ticket/8..._10.1.diff
Reply
#64
Thumbs Up 
tiberian Wrote:I ported the patch to the official xbmc master branch. It worked fine for me. Please give it a try:

http://trac.xbmc.org/ticket/8981
http://trac.xbmc.org/attachment/ticket/8..._10.1.diff

I had completely missed your work ! It's just what I was looking for !!
The visual result is great.

But I have some issues Big Grin
My system "freezes" after of a few secondes listening music (say less than a minute). VFD and main screen locks and no direct input can be done until the LCDd service is restarted (by ssh). Inputs which were sent by pad during the freeze are then executed...
It doesn't seems to append in video playback. spectrum analyser ?

I had the same freezing problem with the perl script when the refresh rate was too short until I red about possible race conditions in LCDproc...

I tried to update LCDproc to the latest 0.5.4-cvs which refereed to a possible lock issue with imonlcd driver but without success.

Imon LCD (15c2:0038) and Ubuntu 10.10. Up-to-date xbmc-pvr (git opdenkamp)
Reply
#65
i've been experiencing an issue where after running normally for a little while LCDd starts spitting garbage every second into syslog and display goes blank. this is without this patch in particular, i guess this will motivate me to look back into it. right now i just killed off LCDd and lcdproc :/
xbmc-pvr-ppa-odk68, Gentoo x86 3.0.7-pf, xorg-server-1.11.2, mesa-7.11, nvidia-drivers-290.10
Reply

Logout Mark Read Team Forum Stats Members Help
Soundgraph iMon LCD - display icons0