XBMC Community Forum
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Development (/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (/forumdisplay.php?fid=174)
+---- Thread: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC (/showthread.php?tid=68263)



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - yallah - 2012-12-29 21:16

Today elupus fix prob with letter case. You can build new installer and try with your configuration.

https://github.com/xbmc/xbmc/commit/0f4032b941563789a073b9d66a31dcb06086a33c


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - rickardkk - 2012-12-31 05:59

With the old EventServer you could choose to turn on broadcasting at high level (including button presses etc).
Is that possible now with JSON-RPC notifications?

Via EventGhost I had my A/V Receiver and screen power on (if off) on left, right, down or up.
Also had a timer triggered on left, right, up, down etc so that a macro could shut down some AV equipment when inactive for a couple of minutes.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-12-31 10:33

EventServer still exists and still has its features that JSON-RPC does not provide. JSON-RPC does not provide any notifications for button presses etc.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - rickardkk - 2012-12-31 15:53

Thanks!

Do you know how to activate it (at the high level)?
I used to do it via the HTTP API:
xbmcCmds/xbmcHttp?command=SetBroadcast&parameter=2;8278


Re: RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jitterjames - 2012-12-31 17:39

(2012-12-31 15:53)rickardkk Wrote:  Thanks!

Do you know how to activate it (at the high level)?
I used to do it via the HTTP API:
xbmcCmds/xbmcHttp?command=SetBroadcast&parameter=2;8278

How are you sending button presses to XBMC? Maybe you can detect them directly from event ghost if you are using IR or the keyboard. If you are using an XBMC app for your phone or tablet then maybe not so easy.

I was also using this method and requesting event nitification via the http API. It should be possible to request it directly through the event client, but I don't know how. If it is not possible, then I think it should be.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - rickardkk - 2012-12-31 17:54

(2012-12-31 17:39)jitterjames Wrote:  
(2012-12-31 15:53)rickardkk Wrote:  Thanks!

Do you know how to activate it (at the high level)?
I used to do it via the HTTP API:
xbmcCmds/xbmcHttp?command=SetBroadcast&parameter=2;8278

How are you sending button presses to XBMC? Maybe you can detect them directly from event ghost if you are using IR or the keyboard. If you are using an XBMC app for your phone or tablet then maybe not so easy.

I was also using this method and requesting event nitification via the http API. It should be possible to request it directly through the event client, but I don't know how. If it is not possible, then I think it should be.

Windows Phone app. I really hope it's possible to activate broadcast as my home automation depends on it (as of now).


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - ndxtg - 2013-01-03 06:09

(2012-05-27 16:15)Mizaki Wrote:  There seems to be a problem with adding directories that are not in the library:
Code:
{"jsonrpc": "2.0", "method": "Playlist.Add", "params": {"item": {"directory": "/mnt/media/audio/Art Brut/Bang Bang Rock 'n Roll/"}, "playlistid": 0}, "id": 1}
Works and is in library.
Code:
{"jsonrpc": "2.0", "method": "Playlist.Add", "params": {"item": {"directory": "/mnt/media/music/A/How Ace Are Buildings/"}, "playlistid": 0}, "id": 1}
Does not work and is not in library. Invalid params is the error.

Am I missing something?

I am having the exact same problem on v4.0
Please help!


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2013-01-03 09:15

Yeah the problem is that the logic doesn't really know what to look for when given a directory that is not part of the library. If it is, it can figure out that it's an album and that it should add all the songs from the album. But when it's not in the library it doesn't know whether it's a tvshow, a season, a movie folder, an artist folder, an album folder or something completely different. Theoretically we could use the hint that "playlistid": 0 is the music playlist but that's most likely not always gonna stay that way and with possible mixed playlists that approach won't work anymore either so I never added the logic. Maybe we should add the "media" property to the "item" property alongside the "directory" property (similar to how Files.GetDirectory) works so that clients can specify what kind of media to look for.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2013-01-03 09:21

Sounds good and can also be applied to Player.open with directory to solve another problem Smile


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - wuench - 2013-01-05 03:21

Running the 20130104-de8789a nightly. The case sensitivity issue of playing blu-ray ISO's is fixed. Thank you.

I have another issue, and I am not sure if this is how it is supposed to be or a bug. Now when I play a blu-ray ISO file using Player.Open, my calls to Player.GetItem return no/blank info. If I play the same file via the GUI the GetItem info is populated. The file is in the library. Is this the same thing Tolriq and others are reporting above? I do see the label, no other info though...

Code:
[Player.Open Example
--------------------------------------
SendTCP: Sending (153 Bytes) - {"id":31,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"smb://AV-NAS/media/Movies/The Amazing Spider-Man/The Amazing Spider-Man.ISO"}}}
GetResp: Response (96 Bytes) - {"jsonrpc":"2.0","method":"Playlist.OnClear","params":{"data":{"playlistid":1},"sender":"xbmc"}}
GetResp: Response (39 Bytes) - {"id":31,"jsonrpc":"2.0","result":"OK"}
...
SendTCP: Sending (194 Bytes) - {"id":51,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["cast","plot","year","mpaa","showtitle","title","season","episode","thumbnail","fanart","streamdetails"]}}
GetResp: Response (270 Bytes) - {"id":51,"jsonrpc":"2.0","result":{"item":{"cast":[],"episode":-1,"fanart":"","label":"The Amazing Spider-Man.ISO","mpaa":"","plot":"","season":-1,"showtitle":"","streamdetails":{"audio":[],"subtitle":[],"video":[]},"thumbnail":"","title":"","type":"unknown","year":0}}}

Played Through GUI Example
-------------------------------------------------
SendTCP: Sending (195 Bytes) - {"id":143,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["cast","plot","year","mpaa","showtitle","title","season","episode","thumbnail","fanart","streamdetails"]}}
GetResp: Response (14799 Bytes) - {"id":143,"jsonrpc":"2.0","result":{"item":{"cast":[{"name":"Andrew Garfield","role":"Spider-Man / Peter Parker","thumbnail":"image://http%3a%2f%2ffiles.mymovies.dk%2fPhotos%2fd6b13260-cfa6-4fa6-9eb9-a9121a48a746.jpg/"},{"name":"Emma Stone","role":"Gwen...

Code:
19:49:05 T:7968   DEBUG: JSONRPC: Incoming request: {"id":210,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["cast","plot","year","mpaa","showtitle","title","season","episode","thumbnail","fanart","streamdetails"]}}
19:49:05 T:7968   DEBUG: JSONRPC: Calling player.getitem
19:49:05 T:7968   DEBUG: CVideoDatabase::GetMovieId (), query = select idMovie from movie join files on files.idFile=movie.idFile where files.idPath=78



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - kevinkelm - 2013-01-05 08:48

Hi,
I'm trying to figure out this json control stuff with Roomie but I'm not quite sure how the parameters should go. Commands with no parameters work fine but I'm not sure what I should use for toggle fullscreen and subtitles. The docs just say this
Parameters:
Global.Toggle fullscreen

This is what I'm trying that doesn't work

{"jsonrpc": "2.0", "method": "GUI.SetFullscreen", "params": { "fullscreen": "true" }, "id": "1"}

Thanks


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2013-01-05 09:35

What's the filename of your ISO? Is it really *.ISO" or is it "*.iso"? Because if the filename you pass in through "file" to Player.Open doesn't match the real filename 100% XBMC won't be able to find the file in the database and therefore won't be able to assign any metadata to it. In the GUI this can't happen because the item you play comes from the database with all the proper information.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2013-01-05 09:37

(2013-01-05 08:48)kevinkelm Wrote:  Hi,
I'm trying to figure out this json control stuff with Roomie but I'm not quite sure how the parameters should go. Commands with no parameters work fine but I'm not sure what I should use for toggle fullscreen and subtitles. The docs just say this
Parameters:
Global.Toggle fullscreen

This is what I'm trying that doesn't work

{"jsonrpc": "2.0", "method": "GUI.SetFullscreen", "params": { "fullscreen": "true" }, "id": "1"}

Thanks

Boolean values (true/false) don't have double quotes around them. So if you want to turn fullscreen on, you do
Code:
{"jsonrpc": "2.0", "method": "GUI.SetFullscreen", "params": { "fullscreen": true }, "id": "1"}
(notice no double quotes around "true").

If you just want to toggle fullscreen no matter the current state, you do
Code:
{"jsonrpc": "2.0", "method": "GUI.SetFullscreen", "params": { "fullscreen": "toggle" }, "id": "1"}
(notice double quotes around the "toggle" because it's an arbitrary string).


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - kevinkelm - 2013-01-05 12:12

That's great thanks. Would this work for toggling subtitles on and off?

{"jsonrpc": "2.0", "method": "Player.SetSubtitle", "params": { "subtitle": "toggle" }, "id": "1"}


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2013-01-05 12:16

You know that testing this command would have been faster than writing the post ? Smile

And the answer is no Smile Reading the introspect would have show you :

Code:
{ "name": "subtitle", "required": true, "type": [
          { "type": "string", "enum": [ "previous", "next", "off", "on" ] },
          { "type": "integer", "minimum": 0, "description": "Index of the subtitle to display" }
        ]
      }

As the valid options