Amarok LCD Script Not Working

Okay so I've been trying to get my new G15 working with Amarok and am having some issues.

For starters I've gotten all the g15 things installed and running. I even started up the x-chat script to show hilights and that runs fine. I can open a pipe to g15compser and send text no problem.

Amarok, however, is giving me issues. I've tried both scripts and am having an issue with both of them:

For the first... I'm getting the error "This Perl hasn't been configured and built properly for the threads module to work. (The 'useithreads' configuration option hasn't been used.)" when I try to run a script.

For the second (the Gentoo one) I see G15Composer show up on my LCD screen, but nothing is ever sent to it. The G15Composer text eventually just disappears leaving a blank screen. I can manually send text through the pipe created with the script... but the script itself isn't sending anything.

Can anyone offer some tips to help me out here?

Re: Amarok LCD Script Not Working

Thanks for the fix frozensolid , much appreciated since I was experiencing the same behaviour in amarok.
The script is much more stable now but it misses the "scrolling" feature on long artist & title names.
If you, or anyone for that matter, work it into the script , it would be great.

Thank you again,
Lazaros

Re: Amarok LCD Script Not Working

Warning... this was a real quick and dirty fixup. I'm sure someone who spent more time on it than I could make it look a bit nicer... and maybe add some of the features of the threaded version. I literally just took out anything that required threading to see if I could get it working. I'd LOVE to have a progress bar and current time... but I haven't messed with it enough to try that without threading.

#!/usr/bin/perl -w</p>
<p>use strict;</p>
<p>my $pipe = "$ENV{HOME}/.g15amaroklcdpipe";</p>
<p>my $mknod = system("mknod $pipe p");</p>
<p>my $G15Cpid = open(G15COMPOSER, "| g15composer $pipe");</p>
<p>my $vol = `dcop amarok player getVolume`;<br />
chomp $vol;<br />
my $tmpStatus = `dcop amarok player status`;<br />
chomp $tmpStatus;<br />
my $status = ( $tmpStatus > 1 ) ? 1 : 0;</p>
<p>open(PIPE, ">>$pipe");<br />
print PIPE "FL 0 10 \"/usr/share/fonts/TTF/Vera.ttf\"\n";</p>
<p>sub volUpdate {<br />
   print PIPE "PC 0\n";<br />
   print PIPE "TO 0 10 2 1 \"Volume\"\n";<br />
   print PIPE "DB 3 27 157 35 2 $vol 100 3\n";<br />
}</p>
<p>while($status == 0) {<br />
   $tmpStatus = `dcop amarok player status`;<br />
   $status = ( $tmpStatus > 1 ) ? 1 : 0;<br />
   sleep 1;<br />
}</p>
<p>my $artist = `dcop amarok player artist`;<br />
my $title = `dcop amarok player title`;<br />
my $album = `dcop amarok player album`;<br />
my $trackTotalSecs = `dcop amarok player trackTotalTime`;<br />
my $trackCurSecs = `dcop amarok player trackCurrentTime`;<br />
my $trackTotalTime = `dcop amarok player totalTime`;<br />
my $trackCurTime = `dcop amarok player currentTime`;<br />
chomp $artist;<br />
chomp $title;<br />
chomp $album;<br />
chomp $trackTotalSecs;<br />
chomp $trackCurSecs;<br />
chomp $trackTotalTime;<br />
chomp $trackCurTime;</p>
<p>&initScreen();</p>
<p>$SIG{TERM} = \&bye;</p>
<p>while(1) {<br />
   $_ = ;<br />
   chomp $_;<br />
   if ( /trackChange/ ) {<br />
      $artist = `dcop amarok player artist`;<br />
      $title = `dcop amarok player title`;<br />
      $album = `dcop amarok player album`;<br />
      $trackTotalSecs = `dcop amarok player trackTotalTime`;<br />
      $trackTotalTime = `dcop amarok player totalTime`;<br />
      $trackCurSecs = `dcop amarok player trackCurrentTime`;<br />
      $trackCurTime = `dcop amarok player currentTime`;<br />
      chomp $artist;<br />
      chomp $title;<br />
      chomp $album;<br />
      chomp $trackTotalSecs;<br />
      chomp $trackCurSecs;<br />
      chomp $trackTotalTime;<br />
      chomp $trackCurTime;<br />
      initScreen();<br />
      $artist = `dcop amarok player artist`;<br />
      $title = `dcop amarok player title`;<br />
      $album = `dcop amarok player album`;<br />
      $trackTotalSecs = `dcop amarok player trackTotalTime`;<br />
      $trackTotalTime = `dcop amarok player totalTime`;<br />
      $trackCurSecs = `dcop amarok player trackCurrentTime`;<br />
      $trackCurTime = `dcop amarok player currentTime`;<br />
      chomp $artist;<br />
      chomp $title;<br />
      chomp $album;<br />
      chomp $trackTotalSecs;<br />
      chomp $trackCurSecs;<br />
      chomp $trackTotalTime;<br />
      chomp $trackCurTime;<br />
      initScreen();<br />
   } elsif ( /engineStateChange/ ) {<br />
                if( /playing/ ) {<br />
                        $status = 1;<br />
         initScreen();<br />
                } elsif ( /pause/ ) {<br />
                        $status = 0;<br />
                } else {<br />
                        $status = 0;<br />
                }<br />
        } elsif( /volumeChange/ ){<br />
                m/: (\d+)/;<br />
                $vol = $1;<br />
      $status = 0;<br />
      &volUpdate();<br />
      $status = 1;<br />
        }<br />
   exit if( /exit/ );<br />
   &bye() if( /kill/ );<br />
}</p>
<p>sub initScreen {<br />
   print PIPE "MP 0\n";<br />
   print PIPE "MC 1\n";<br />
   print PIPE "PC 0\n";<br />
   print PIPE "DR 0 0 159 43 1 1\n";<br />
   print PIPE "DR 3 22 157 40 1 0\n";<br />
   print PIPE "PB 3 22 157 24 0\n";<br />
   print PIPE "FP 0 15 0 0 0 1 \" $artist \"\n";<br />
   print PIPE "FP 0 9 0 15 0 1 \" $title \"\n";<br />
   print PIPE "DB 3 27 157 35 2 $trackTotalSecs 3\n";<br />
   print PIPE "TO 0 35 0 1 \"    $trackTotalTime    \"\n";<br />
   print PIPE "MC 0\n";<br />
}</p>
<p>sub bye {<br />
   $status = -1;<br />
   sleep 2;<br />
   print PIPE "PC 0\n";<br />
   system("kill 15 $G15Cpid");<br />
   close(PIPE);<br />
   close(G15COMPOSER);<br />
   $mknod = system("rm $pipe");<br />
   exit 0;<br />
}

Re: Amarok LCD Script Not Working

Frozen-Solid wrote:
Okay so I tried the script with the threads in it again... and took out all of the threading. Now it works awesomely... except that the g15composer instance isn't being closed when amarok is closed. :[

I was considering doing the same thing myself to try to remove the dependency on threading. Can you send me what you've got and I'll look into cleaning up g15composer when the script dies.

Re: Amarok LCD Script Not Working

Okay so I tried the script with the threads in it again... and took out all of the threading. Now it works awesomely... except that the g15composer instance isn't being closed when amarok is closed. :[

Re: Amarok LCD Script Not Working

I know a decent enough amount of perl... but nothing about scripting Amarok.

I'm not seeing any debugging messages printed to the console when I run amarok with the script running... I've tried adding a few echo commands here and there... but those don't seem to put anything out to the console either so I'm not sure. :\

Re: Amarok LCD Script Not Working

I'm not sure how familiar you are with scripting. Would you be able to insert some debugging output that would let you know whether the script is running and reaching the code that should be sending text to g15composer?