If what you want to do is simply capture the path of the
*currently-playing song* rather than one randomly clicked on in the LMS
GUI, a tiny perl script like this
Code:
--------------------
#!/usr/bin/perl
use JSON::RPC::Client;
use JSON::XS;
no warnings 'uninitialized';
$client = new JSON::RPC::Client;
$res = $client->call( "http://192.168.1.10:9000/jsonrpc.js", { method =>
'slim.request', params => [ '00:04:20:11:22:33', ['status', '-', '1', 'tags:u'
]]});
if ($res->is_success) {
$response=$res->jsontext; $jdata=decode_json $response;
$json = JSON::XS->new->pretty(1)->canonical(1)->encode($jdata);
print "$json\n";
}
--------------------
will produce output like this
Code:
--------------------
{
"method" : "slim.request",
"params" : [
"00:04:20:11:22:33",
[
"status",
"-",
"1",
"tags:u"
]
],
"result" : {
"can_seek" : 1,
"digital_volume_control" : 1,
"duration" : 348.455,
"mixer bass" : "0",
"mixer treble" : "0",
"mixer volume" : 19,
"mode" : "play",
"player_connected" : 1,
"player_ip" : "192.168.1.13:37256",
"player_name" : "Office",
"playlist mode" : "off",
"playlist repeat" : 2,
"playlist shuffle" : 0,
"playlist_cur_index" : "10",
"playlist_loop" : [
{
"id" : 719006,
"playlist index" : 10,
"title" : "Alone Tonight (Above & Beyond's Club Mix Mixed)",
"url" :
"file:///volume1/music/served/Trance/Super8%20&%20Tab/Super8%20&%20Tab%20-%2020%20Years%20of%20Anjunabeats/1-11%20[A%20&%20B]%20Alone%20Tonight%20(Above%20&%20Beyond%27s%20Club%20Mix%20Mixed).flac"
}
],
"playlist_timestamp" : 1605272315.77755,
"playlist_tracks" : 39,
"power" : 1,
"rate" : 1,
"seq_no" : 0,
"signalstrength" : 0,
"time" : 26.7784540042877
}
}
--------------------
which contains the path information in the *url *field. No need to go
near the LMS GUI for this info, just grab it using the jsonrpc.js API.
This example is perl but I've done it in python, bash and nodejs too.
Just sayin'...
------------------------------------------------------------------------
philchillbill's Profile: http://forums.slimdevices.com/member.php?userid=68920
View this thread: http://forums.slimdevices.com/showthread.php?t=113145
_______________________________________________
Squeezecenter mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/squeezecenter