Kodi Community Forum

Full Version: JSON and Player info
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I would like to retrieve informations about the movie or TV show currently play in XBMC :
- Episode or movie name
- Thumb
- Duration
- And current position

It's possible with JSON-RPC ? And if yes, how ?

Thank's in advance.
What version of XBMC are you using? If you use the very latest nightly build (from today) you must first call Player.GetActivePlayers, retrieve the playerid of the currently playing item and then call Player.GetProperties to retrieve the "playlistid" and the "position". Then you can call Playlist.GetItems to retrieve all items of that playlist and retrieve the current item using the value of "position". Using the "fields" parameter you can define the details you would like to retrieve like "title", "thumbnail" and "runtime" in your case.

We will consider adding a "currentitem" property to Player.GetProperties but we couldn't decide yet what information to provide (just the database ID's or additional detail).
I use the last stable version of XBMC. But if the version of the API change, I could manage different call with this number. So, I don't have the last nightly build what function I need to call ?
IIRC you need to call Player.GetActivePlayers to get the type of the player that is currently running. Then you need to call either VideoPlaylist.GetItems or AudioPlaylist.GetItems (depending on the type of player Player.GetActivePlayers returned). GetItems returns a list of items and a "current" value indicating the index of the currently playing item in the returned list of items. GetItems also takes the "fields" parameter to define what kind of information you would like.