Thanks karlek, 

I saw the error in the code I copied in and was editing it when I saw
your post. I've corrected the original post now, but the code was not
the issue. I'm trying what you said, and have the jsonrpc on debug level
logging. 

Around line 281 the JSON response to be returned looks like this:

{
id => 53,
method => "slim.request",
params => ["98:fe:95:00:00:00", ["spotty", "items", 0, 8,
"want_url:1"]],
result => {
# tied Tie::IxHash
count => 8,
loop_loop => [
{
# tied Tie::IxHash
hasitems => 1,
id => 0,
image => "plugins/Spotty/html/images/search.png",
isaudio => 0,
name => "Search",
type => "search",
},
{
# tied Tie::IxHash
hasitems => 1,
id => 1,
image => "plugins/Spotty/html/images/whatsnew.png",
isaudio => 0,
name => "What's New",
type => "link",
},
{
# tied Tie::IxHash
hasitems => 1,
id => 2,
image => "plugins/Spotty/html/images/toptracks.png",
isaudio => 1,
name => "Top Tracks",
type => "playlist",
url => sub { "???" },
},
{
# tied Tie::IxHash
hasitems => 1,
id => 3,
image => "plugins/Spotty/html/images/inbox.png",
isaudio => 0,
name => "Genres and Moods",
type => "link",
},
{
# tied Tie::IxHash
hasitems => 1,
id => 4,
image => "plugins/Spotty/html/images/inbox.png",
isaudio => 0,
name => "Afternoon jams",
},
{
# tied Tie::IxHash
hasitems => 1,
id => 5,
image => "plugins/Spotty/html/images/account.png",
isaudio => 0,
name => "A's Library",
},
{
# tied Tie::IxHash
hasitems => 1,
id => 6,
image => "plugins/Spotty/html/images/account.png",
isaudio => 0,
name => "M's Library",
},
{
# tied Tie::IxHash
hasitems => 1,
id => 7,
image => "plugins/Spotty/html/images/playlist.png",
isaudio => 0,
name => "Transfer Playback",
type => "link",
},
],
},
}

But by 291 : my $jsonResponse = to_json($responseRef);
The responseRef is either altered, missing or invalid since the error is
:
[20-08-19 16:48:45.1964] Slim::Web::JSONRPC::handleURI (281) While
trying to run function coderef [Slim::Web::JSONRPC::requestMethod]:
[encountered CODE(0x659ea38), but JSON can only represent references to
arrays or hashes at /usr/share/perl5/Slim/Web/JSONRPC.pm line 291.
]

I'm guessing that something in the JSON response is invalid and can't be
turned into JSON by the function to_json. Unfortunately I'm not sure
what that would be. I'm thinking the suspect is : "url => sub { "???"
},"

I have traced this to line 215 in the OPML.pm file in the Spotty plugin.
If I comment this line out... the JSON gets returned properly.
Unfortunately I don't understand why. I think it has something to do
with how the url value is returned. the type is "playlist" where the
rest are "link". If I change the entry "type  => 'playlist'," to "type 
=> 'link'," the JSON gets returned properly.

I guess I'm now wondering if "playlist" type entries have to have
something special done to them to work with the JSON interface?

Also, this "type" appears in several other lists throughout the plugin
as far as I can see (from the OPML.pm file). I'm not sure how to find
them in the UI but I'm guessing they would break the JSON as well? 

I'm trying to figure out a way to either change the Spotty plugin, or
something else in LMS to allow me to use the Spotty plugin with the JSON
RPC interface and I'm not sure where to go from here. Anyone have any
ideas?

Thanks


------------------------------------------------------------------------
littla's Profile: http://forums.slimdevices.com/member.php?userid=63581
View this thread: http://forums.slimdevices.com/showthread.php?t=112794

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

Reply via email to