Hi,
I am in the process of finishing the migration of my 'LMS emacs
controller'
(https://forums.slimdevices.com/showthread.php?107769-Announce-lms-el-a-squeezebox-controller-for-emacs)
to use HTTP requests instead of a telnet connection.
It's working smoothly, the code is simpler and more beautiful, but I've
found a problem when making requests passing UTF-8 encoded data, the
`url-retrieve` library in emacs does not accept multibyte parameters.
I've tried to replicate the requests using curl:
Case (a) works both with curl and with the equivalent elisp (emacs lisp)
code, (b) works with curl but not in elisp code (i.e., my issue).
So I tried "hexifying" the search parameter, as in (c) or (d), but LMS
doesn't like the query and does not return the proper answer, even with
curl.
Is there a way to indicate LMS HTTP server that data is hexifyed and it
needs to unhex before handling? f.e. using any special header in the
request or something?
I'm using LMS v7.9.2 in a Sinology DS215j
Thanks,
Iñigo
WORKS:
(a)
Code:
--------------------
$ curl -s -H "Content-Type: application/json" -X POST -d
'{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX",
["artists",0,10,"search:\'Bob Dylan\'"]]}' http://nas:9002/jsonrpc.js
{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX",["artists","0",10,"search:'Bob
Dylan'"]],"result":{"artists_loop":[{"artist":"Bob
Dylan","id":19929},{"artist":"Bob Dylan & The Band","id":19930},{"artist":"Bob
Dylan & Neil Young","id":19931}],"count":3}}
--------------------
(b)
Code:
--------------------
$ curl -s -H "Content-Type: application/json" -X POST -d
'{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX",
["artists",0,10,"search:\'Björk\'"]]}' http://nas:9002/jsonrpc.js
{"params":["XX:XX:XX:XX:XX:XX",["artists","0",10,"search:'Björk'"]],"result":{"count":1,"artists_loop":[{"id":19753,"artist":"Björk"}]},"method":"slim.request"}
--------------------
DOES NOT WORK:
(c)
Code:
--------------------
$ curl -s -H "Content-Type: application/json" -X POST -d
'{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX",
["artists",0,10,"search:\'Bob%20Dylan\'"]]}' http://nas:9002/jsonrpc.js
{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX",["artists","0",10,"search:'Bob%20Dylan'"]],"result":{"count":0}}
--------------------
(d)
Code:
--------------------
$ curl -s -H "Content-Type: application/json" -X POST -d
'{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX",
["artists",0,10,"search:\'Bj%C3%B6rk\'"]]}' http://nas:9002/jsonrpc.js
{"result":{"count":0},"params":["XX:XX:XX:XX:XX:XX",["artists","0",10,"search:'Bj%C3%B6rk'"]],"method":"slim.request"}
--------------------
------------------------------------------------------------------------
Iñigo's Profile: http://forums.slimdevices.com/member.php?userid=49912
View this thread: http://forums.slimdevices.com/showthread.php?t=112400
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins