I've been diving into the world of jsonrpc, feedback and regex trying to pull info from my raspberry pi running xbmc with varying amounts of success
and hoping someone can help. I started by using the Demopad XBMC download but it seems this was written "pre Frodo" and that the commands changed following xbmc dropping HTTP api in favour of json rpi. I think!? I've been using both Hercules and the regex tester website and managed to send an initial request for currently playing info in Hercules using the following whilst connected to xbmcipaddress on port 9090;
/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist", "duration", "thumbnail", "file", "fanart", "streamdetails"], "playerid": 0 }, "id": "AudioGetItem"}$0D$0A
which works and returns;
{"id":"AudioGetItem","jsonrpc":"2.0","result":{"item":{"album":"Collected","artist":["Massive Attack"],"duration":340,"fanart":"","file":"/var/media/08DA-91F3/Music/Massive Attack/Collected/15 False Flags.m4a","id":340,"label":"False Flags","thumbnail":"image://%2fvar%2fmedia%2f08DA-91F3%2fMusic%2fMassive%20Attack%2fCollected%2ffolder.jpg/","title":"False Flags","type":"song"}}}
from which the regex
"title":"([A-Za-z0-9\s:-]*)
produces
Match $1
"title":"Teardrop Teardrop
I can't find a way to just leave Teardrop so any help with that too would be appreciated
I tried the suggestion including a question mark but it still produced the same results (sorry, I forget the exact use of the ?)
So, I have set up a device called XBMCNEW with the my xbmc ip address on port 9090 and set up feedback on this to send the result of "title":"([A-Za-z0-9\s:-]*) to a label called TrackTitle. I then have an image on a page with DynamicLabel for TrackText. I have a button that sends the following command to device XBMC, which when I put the equivalent (xbmcipaddress:80/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist", "duration", "thumbnail", "file", "fanart", "streamdetails"], "playerid": 0 }, "id": "AudioGetItem"}$0D$0A) into a web browser returns the information as shown further above - I used port 80 doing this as the xbmc jsonrpc wiki said to);
{"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist", "duration", "thumbnail", "file", "fanart", "streamdetails"], "playerid": 0 }, "id": "AudioGetItem"}$0D$0A
However, finally getting to the point
, the dynamic label image remains blank!?
I have tried changing all sorts of things such as sending data to a webpage using
xbmcipaddress:80/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist", "duration", "thumbnail", "file", "fanart", "streamdetails"], "playerid": 0 }, "id": "AudioGetItem"}$0D$0A
And changing the port to 80 and maintaining an active connection and not maintaining an active connection and adding /jsonrpc?request to the end of the xbmc ip address in the device and so many other things I can't even remember!?
If anyone can understand my ramblings and has a straight forwards "just do this......" suggestion it will save me yet more confusion and I will be extremely grateful
Cheers