Posts: 794
Joined: Apr 2011
Reputation:
16
Mizaki
Posting Freak
Posts: 794
To re-confirm then. There is no way to mitigate against a large library and slow machine (ATV2 for example)? The problem is, by the sounds of it, I have someone who is timing out on the call before the results can be returned.
Posts: 5,184
Joined: Jan 2009
Reputation:
131
Currently not because no matter what parameters you pass JSON-RPC will always retrieve all the matching items and then do the sorting and after that the limiting.
Always read the
online manual (wiki),
FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the
forum rules (wiki).
Please read the pages on
troubleshooting (wiki) and
bug reporting (wiki) before reporting issues.
Posts: 19
Joined: Jan 2012
Reputation:
0
2012-02-24, 18:24
(This post was last modified: 2012-02-24, 18:24 by devastator83.)
Hi,
I love the 'new' JSON API! At the moment I am writing a script for my Philips Pronto remote control.
Whenever it 'wakes up' from sleep, I have to do 3 requests:
1) GetActivePlayer: to check if the active player has changed while the remote was sleeping
2) Player.GetProperties (if 1 returned a player): to get the player status
3) Player.GetItem: to check if the played video/song changed.
It would be handy if I could do this with 1 or 2 calls only.
GetActivePlayer could e.g. return the speed and the library id of the currently played item.
I cache the library item id to check if the playback item has changed, in which case I download the new data with Player.GetItem.
Or does such a call already exist to fit my needs ?
Thanks for your work !
Posts: 5,184
Joined: Jan 2009
Reputation:
131
No but you can do 2) and 3) in a batch request i.e. send them together in one request and receive the response together as well. You still need to parse and evaluate them seperately but you save some time because you don't have to wait for 2) to finish before sending 3).
Always read the
online manual (wiki),
FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the
forum rules (wiki).
Please read the pages on
troubleshooting (wiki) and
bug reporting (wiki) before reporting issues.
Posts: 151
Joined: Jan 2005
Reputation:
0
jimk72
Senior Member
Posts: 151
I am trying to get the length or "duration" of a movie but the results do not return. I am displaying currently playing items and when a song is selected it displays the duration but not when a movie is played. Is there a different property i should be requesting?
{"jsonrpc":"2.0","id":10,"method":"Player.GetItem","params":{"playerid":'+inttostr(GetActivePlayer)+',"properties":["thumbnail","artist","duration","album"]}}
results if movie:
{"id":10,"jsonrpc":"2.0","result":{"item":{"album":"","artist":"","id":133,"label":"Abduction","thumbnail":"special://masterprofile/Thumbnails/Video/3/3ce2f0b8.tbn","type":"movie"}}}
results if song:
{"id":10,"jsonrpc":"2.0","result":{"item":{"album":"The Black Parade","artist":"My Chemical Romance","duration":299,"id":1028,"label":"Famous Last Words","thumbnail":"special://masterprofile/Thumbnails/Music/8/8546d948.tbn","type":"song"}}}
Posts: 5,184
Joined: Jan 2009
Reputation:
131
Yes you need to request the "runtime" property for video items. But that property is a string and can contain things like "mins" etc. An alternative is to also retrieve "streamdetails" and look at the video stream. It should contain a seconds-based number for the length of the stream. Can't remember the name off the top of my head so look into introspect, the wiki or the response of your request.
Always read the
online manual (wiki),
FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the
forum rules (wiki).
Please read the pages on
troubleshooting (wiki) and
bug reporting (wiki) before reporting issues.
Posts: 5
Joined: Feb 2012
Reputation:
0
I am trying to build a webinterface for my iPhone which also will be sending out IR commands to my reciever. In the new JSON-RPC Api I can't find anything that will help me with that. Is that correct? Should I use a different technique for that?
Posts: 5,184
Joined: Jan 2009
Reputation:
131
What does XBMC's JSON-RPC have to do with IR commands? I have no clue but I don't know about XBMC's core being able to send IR commands.
Always read the
online manual (wiki),
FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the
forum rules (wiki).
Please read the pages on
troubleshooting (wiki) and
bug reporting (wiki) before reporting issues.
Posts: 5
Joined: Feb 2012
Reputation:
0
I thought the JSON-RPC is the way to go to communicate with XBMC. Since the Wikipage says the HTTPApi is depreciated.
However I wasn't able to use JSON-RPC to use one of the Builtin commands, which is quite easy using the HTTPApi. I'm using the HTTPApi now to execute Lirc.Send, which is fine by me.
Posts: 5,184
Joined: Jan 2009
Reputation:
131
Ah right. Yeah the JSON-RPC API will not allow direct access to the Builtin commands. These are generally meant for XBMC internal purposes and for skins. Certain builtin commands are wrapped in JSON-RPC commands (with parameter-checking etc) if necessary. I'm not sure but maybe the EventServer allows access to the builtin methods as well.
Always read the
online manual (wiki),
FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the
forum rules (wiki).
Please read the pages on
troubleshooting (wiki) and
bug reporting (wiki) before reporting issues.