Great!
"status - 1 current_title" did the trick! Thanks a lot!
It's not formatted like it appears on the display of the squuezebox,
but since I was just playing around, I'm happy with that solution.
Here's what I did, for anybody who's interested:
#!/usr/bin/perl -w
use warnings;
use strict;
use Net::Telnet;
use URI::Escape;
my $telnet = new Net::Telnet( Timeout=>2, Errmode=>'die') ;
$telnet->open(Host=>'localhost', Port=>9090);
if (runCmd($telnet, 'mode') =~ /play/) {
$_ = runCmd($telnet, 'status', undef, '- 1 current_title:');
/\stitle:(.+?)\s(?:[a-z]+:.*\s)?artist:(.+?)\s[a-z]+:/i;
printf('%s (%s)', $1, $2);
}
sub runCmd {
my ($socket, $cmd, $returnSocket, $value) = @_;
$value = '?' unless $value;
my $fullcmd = "[HERE GOES YOUR PLAYERS MAC ADDRESS] $cmd $value";
$socket->print($fullcmd);
$socket->waitfor("/$cmd/i");
return $returnSocket?$socket:getResponse($socket);
}
sub getResponse {
my ($socket) = @_;
return uri_unescape($socket->getline);
}
exit;
--
TomTom101
------------------------------------------------------------------------
TomTom101's Profile: http://forums.slimdevices.com/member.php?userid=9240
View this thread: http://forums.slimdevices.com/showthread.php?t=64240
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins