Re: [SlimDevices: Plugins] LastFM: Which CLI command to retrieve meta data of the currently playing song

2009-06-09 Thread TomTom101

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
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


[SlimDevices: Plugins] LastFM: Which CLI command to retrieve meta data of the currently playing song

2009-06-07 Thread TomTom101

Hey,

I recently found GeekTool and want to use it to show the currently
playing song on my desktop.

I wrote a simple Perl script that gets this data via the telnet
interface simply issuing a current_title ? command.

This works fine while playing songs from the library, but when it comes
to the LastFM Plugin it will show what the playlist shows, namely sth.
like 'Recommended Titles' or 'Neighbors'.

I didn't yet find a way to get to the information displayed in the
player control section above the playlist, the meta data of the
currently playing song as retrieved by lastfm.com!

I grep'ed through the whole slimserver folder for addDispatch to find
any commands that could be useful, tried an awful lot of commands but
found nothing.

Is there a way to get this information via CLI commands?

Thanks a lot in advance!

Best,
Thomas


-- 
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
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] LastFM: Which CLI command to retrieve meta data of the currently playing song

2009-06-07 Thread Michael Herger
 I wrote a simple Perl script that gets this data via the telnet
 interface simply issuing a current_title ? command.

Use the status query instead.

-- 

Michael
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins