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

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



- wuench - 2011-01-28

My thoughts were to have one interface for playback and direct commands to the active player. If I can get some sort of indicator that an external player is active (even better if I knew which one) then a play button, for example, could send the play command to the active player.

One could just send all commands to all players, but that might have side effects on players/programs that are running in the background.


- Montellese - 2011-01-28

As we're already talking about changes, just an FYI: We have added support for Batch requests (as described in the specification) and Announcements(called "notifications" in the spec; just requests with no "id" field which won't get a response).


- topfs2 - 2011-01-28

wuench Wrote:My thoughts were to have one interface for playback and direct commands to the active player. If I can get some sort of indicator that an external player is active (even better if I knew which one) then a play button, for example, could send the play command to the active player.

One could just send all commands to all players, but that might have side effects on players/programs that are running in the background.

That actually just make me want to state even more that it shouldn't be possible. A client should never need to poke the external player by itself, xbmc should always relay, otherwise there is no way xbmc could keep track of the state (atleast no garantue). Heck, its even arguably a security risk. If we don't relay and the client know foo external player is running, it could try to hack that external player. Ofcourse this could happen no matter if we give the info but atleast there is some obscurity.

Besides, any external player should behave for any client (and users) as an internal one.


- wuench - 2011-01-28

Maybe I need to describe a little better what I am working on. I am writing a driver for Charmed Quark Controller (CQC) to control XBMC. CQC is a home automation control program capable of controlling various devices and applications. Along the lines of Crestron, Control4, HomeSeer, etc.

Security in XBMC is not really a factor in this, that is between CQC and whatever other stuff it is controlling. CQC is the central controller in my scheme not XBMC. So I need to determine when XBMC has called out to an external player so I can direct commands at the other applications.

I was just wondering if there was a way to do it using InfoLabels or Booleans, etc. Not asking you to implement anything. If necessary I can work on detecting when the other apps have focus or are running. It would just be nice to get that info from XBMC since it has the best idea of it's current state.


- topfs2 - 2011-01-28

wuench Wrote:Maybe I need to describe a little better what I am working on. I am writing a driver for Charmed Quark Controller (CQC) to control XBMC. CQC is a home automation control program capable of controlling various devices and applications. Along the lines of Crestron, Control4, HomeSeer, etc.

Security in XBMC is not really a factor in this, that is between CQC and whatever other stuff it is controlling. CQC is the central controller in my scheme not XBMC. So I need to determine when XBMC has called out to an external player so I can direct commands at the other applications.

I was just wondering if there was a way to do it using InfoLabels or Booleans, etc. Not asking you to implement anything. If necessary I can work on detecting when the other apps have focus or are running. It would just be nice to get that info from XBMC since it has the best idea of it's current state.

Security of xbmc might not be a factor for your stuff but it is in most cases, so this will not go in based on those needs, I need to have more reasons than that for it. XBMC is designed around being in charge of the system, its a framework if you will. It needs to have control and its designed to be the users input (and as such most likely most clients since they most of the time are triggered by users).

I don't think there is any infobool or anything (for the same reasons, its not interesting for skinners and the likes) which expose which player is running. In your case, its really not a good idea if you redirect other apps to frak around with our external player I will give you one big reason for this, our statemachine is not going to be reliable.

say we start playback and knows it is at X min. If you go in and pause outside xbmc unless the player actively tells us that it is at pause we will still think its at play. Say a skinner pops up controls on paused by design, you going in and pauseing will make the skinning wrong. Even worse, say xbmc tells it to pause and the player unpause. The whole statemachine doesn't work if you allow this type of stuff.

Only way for you to do this would most likely be to parse the Debug Log.


Use a wildcard as a parameter? - turbolag - 2011-01-28

Is it possible to use a wildcard as a parameter, for example, if I want to get a list of artists regardless of genre?


- topfs2 - 2011-01-28

turbolag Wrote:Is it possible to use a wildcard as a parameter, for example, if I want to get a list of artists regardless of genre?

No way to search but you can just omit the genreid and it will give you all genres


- Tolriq - 2011-01-29

any chance to have a solution for getting the all seasons thumb ? Smile


- Gotcha007 - 2011-01-30

HI guys, little question for you.
I'm trying to send a notification on the XBMC screen with JSON but no luck.
How do I do it with the code previously given into that topic?

Code:
import json
import httplib, urllib
import sys

for arg in sys.argv:
    print arg

url = 'http://localhost:8082'
jsonrpcurl = url + '/jsonrpc'

if len(sys.argv) > 2:
  postdata = '{"jsonrpc": "2.0", "method": "' + sys.argv[1] + '", "params": ' + sys.argv[2] + ', "id": "1"}'
else:
  postdata = json.dumps({'jsonrpc': "2.0", 'method': sys.argv[1], 'id': "1"})

#print postdata

respdata = urllib.urlopen(jsonrpcurl, postdata).read()
print respdata

I tried that but with no luck

Code:
python test5.py JSONRPC.Announce '{ "start", "end"}'

Thanks in advance


- topfs2 - 2011-01-30

Announce announces stuff to other clients, not to the screen.


- Gotcha007 - 2011-01-30

topfs2 Wrote:Announce announces stuff to other clients, not to the screen.

Ok sorry Confused
So how do I do to send an announcement to the xbmc screen via JSON?


Bad client permission - turbolag - 2011-01-30

It seems I can successfully get movie and TV show thumbnails, but when I attempt to download album covers, I get error -32099, "Bad Client Permissions".

When I call JSONRPC.Permission, I get true for all items.


- topfs2 - 2011-01-30

turbolag Wrote:It seems I can successfully get movie and TV show thumbnails, but when I attempt to download album covers, I get error -32099, "Bad Client Permissions".

When I call JSONRPC.Permission, I get true for all items.

Debug Log and post exactly what you send, otherwise its impossible to say anything about it


- dann0 - 2011-01-30

I have just read through this thread and i should say thankyou to everyone who has put there efforts into this interface, i use it and i love it!

It seems that playlist management has not been a strong part of this project to date, I was wondering if playlist management is an area that has received attention in the upcoming version 11? IMO playlist management is a vital part of any media management software but is (sadly) often lacking.


- turbolag - 2011-01-30

Request:
Code:
{"method":"Files.Download","id":"1","jsonrpc":"2.0","params":"special://masterprofile/Thumbnails/Music/Fanart/75f862ca.tbn"}

Response:
Code:
{
   "error" : {
      "code" : -32099,
      "message" : "Bad client permission."
   },
   "id" : "1",
   "jsonrpc" : "2.0"
}