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)



- Kabooga - 2010-04-22

Quote:Tolriq Wrote:
And for work i was talking about real life work , after all there's more important things than XBMC

Blasphemy!!!! Big Grin


- noem - 2010-04-23

Hello All,
Im Playing arround with the jsonrpc and I have a question where can I get the parametrs for the functions?
ie:
Quote:XBMC.SetVolume '{ Huh : 12 }'
thx


- Bram77 - 2010-04-25

I've started writing a Ajax/jQuery driven web interface today, using the JS library I'm developing. It's just a demo app but it's a lot of fun to write.
I wish I could get all data that's updated every second in one request. That would make the code a lot prettier and the app a lot more efficient.....

So far I have the Now Playing Audio- and controls part mostly done. There is still a lot of work to do and it doesn't look pretty, but it's a start Smile There some fading and sliding going on you obviously can't see in the screenshot :p

Next are...
Now Playing Video
Now Playing Picture
Tabbed media browser (files, libraries, filters); left side
Tabbed Media Info and Playlists; right side


- noem - 2010-04-25

Can anyone tell me where can I get the jsonrpc method parameters from ?
thx


- topfs2 - 2010-04-25

Nice bram!

Sorry everyone, have had a really hectic week so haven't had time to do much. Hopefully next week will calm down abit but I fear not.

noem Wrote:Can anyone tell me where can I get the jsonrpc method parameters from ?
thx

JSONRPC.Introspect or point to http://localhost:8080/development.html (should be a tab in the standard webinterface now).


- noem - 2010-04-26

topfs2 are you going to include the pvr stuff support also in json ?


- spiff - 2010-04-26

certainly not before it's merged to trunk.


- Kabooga - 2010-04-27

Does the method "Playlist.Add" have a recursive option like "AddToPlayList" in the original API?


- topfs2 - 2010-04-27

Kabooga Wrote:Does the method "Playlist.Add" have a recursive option like "AddToPlayList" in the original API?

Not sure how you mean? You can do

Playlist.Add(albumid=X) and it will add all that album. However if you call Playlist.Add(file=Y) it will only add that file, not sure how to handle directories yet since it depend on the content so directories haven't been wrapped yet.

Or do you mean something that recursively goes down the directory given?


- Bram77 - 2010-04-27

Maybe Playlist.Add(directory=Y, media=audio/video) could do the trick.
If I remember correctly this is how it's done in the http api.

A method like this would be very helpful and reduce overhead. Just as methods to retrieve the state of some elements in XBMC would be, like...
I've created a Status namespace in the JS lib for these kind of methods. At this point it contains the available now playing data, playingTime/percentage and the current volume

isShuffleEnabled
isRepeatEnabled
getRepeatMode
isPartyModeEnabled
isWinding (not shure how to name this in english, return if fastforward or rewind is currently active)
isMuted
isPaused
isAudioPlaying (not really necessary, but useful)
isVideoPlaying (not really necessary, but useful)
isMediaPlaying (shorthand for "isAudioPlaying || isVideoPlaying" )
isPictureShowing (not really necessary, but useful)

...or whatever naming convention you prefer Smile

I haven't been able to retrieve the shares available. Could you point me in the right direction?
The audio playlist items only contain labels, file paths and thumbnail paths. Would it be possible to add artist, album, year, time etc... if available?
Or do you have an alternate method in mind?


edit: To give you an idea about how I think the status data could be updated more efficiently you could take a look at the Status namespace I'm creating for the JS lib. It will probably be devided into / extended with Status.NowPlaying, Status.Controls i.e.. The 'update()' method is executed every second (as often as possible), which results in 5 request to the JSON RPC api at this point.

When HTML5 is the standard, I could create a separate thread for the browser to use as a working thread so these requests won't influence the browsers performance. But at this point the requests do slow down the browser significantly. When and if more methods are implemented to retrieve the current element statuses the amount of requests will increase... Creating a method to get all the data in one request would really help with building a solid and reliable client.

Keep in mind that JS has very limit OOP possibilities and this is just a mockup. I had to make some methods publicly available to do the things I wanted to do.
http://code.google.com/p/xbmcweb/source/browse/trunk/branches/0.2.0/library/xbmc/lib/status.js


- Kabooga - 2010-04-27

In response to topfs2 question.

Quote:From Wiki on AddToPlaylist API:
If recursive = "1" and media is a folder then all appropriate media within subfolders beneath media will be added otherwise only media within the folder media will be added.

The recursive ability to add ALL music (or video) files contained in a selected directory (and subdirectories) was very useful.

Regards,
Kabooga


- noem - 2010-04-27

What about interface integration commands ie: the httpapi SendKey function is that also going to be added ?
Keep up the grate job you are doing there Smile Im currently developing app based on your framework. and sorry for all the bugging Smile

Kind regards
noem


- Bram77 - 2010-04-28

Today's screenshot... Tongue

Image


- topfs2 - 2010-04-28

Kabooga Wrote:In response to topfs2 question.



The recursive ability to add ALL music (or video) files contained in a selected directory (and subdirectories) was very useful.

Regards,
Kabooga
Bram77 Wrote:Maybe Playlist.Add(directory=Y, media=audio/video) could do the trick.
If I remember correctly this is how it's done in the http api.
Sounds like a good plan.

Playlist.Add(directory=X, content=Y, recursive=true)
Bram77 Wrote:A method like this would be very helpful and reduce overhead. Just as methods to retrieve the state of some elements in XBMC would be, like...
I've created a Status namespace in the JS lib for these kind of methods. At this point it contains the available now playing data, playingTime/percentage and the current volume

isShuffleEnabled
isRepeatEnabled
getRepeatMode
isPartyModeEnabled
isWinding (not shure how to name this in english, return if fastforward or rewind is currently active)
isMuted
isPaused
isAudioPlaying (not really necessary, but useful)
isVideoPlaying (not really necessary, but useful)
isMediaPlaying (shorthand for "isAudioPlaying || isVideoPlaying" )
isPictureShowing (not really necessary, but useful)

...or whatever naming convention you prefer Smile

I haven't been able to retrieve the shares available. Could you point me in the right direction?
You mean Files.GetShares ?
Bram77 Wrote:The audio playlist items only contain labels, file paths and thumbnail paths. Would it be possible to add artist, album, year, time etc... if available?
Or do you have an alternate method in mind?
Yeah thats abit of a bug now, you should be able to get them API-wise through the same mechanism as with with the library. fields: ["artist", "album", "year"]
Bram77 Wrote:edit: To give you an idea about how I think the status data could be updated more efficiently you could take a look at the Status namespace I'm creating for the JS lib. It will probably be devided into / extended with Status.NowPlaying, Status.Controls i.e.. The 'update()' method is executed every second (as often as possible), which results in 5 request to the JSON RPC api at this point.

When HTML5 is the standard, I could create a separate thread for the browser to use as a working thread so these requests won't influence the browsers performance. But at this point the requests do slow down the browser significantly. When and if more methods are implemented to retrieve the current element statuses the amount of requests will increase... Creating a method to get all the data in one request would really help with building a solid and reliable client.

Keep in mind that JS has very limit OOP possibilities and this is just a mockup. I had to make some methods publicly available to do the things I wanted to do.
http://code.google.com/p/xbmcweb/source/browse/trunk/branches/0.2.0/library/xbmc/lib/status.js

something like Player.GetInfo with the appropriate fields perhaps?


noem Wrote:What about interface integration commands ie: the httpapi SendKey function is that also going to be added ?
Keep up the grate job you are doing there Smile Im currently developing app based on your framework. and sorry for all the bugging Smile

Kind regards
noem
Yeah I will add that at some point, however not at this stage EventServer is better to use for now.

The reason for this is that core is abit messy regarding input so to create a good clean API I think core needs to be cleaned up.


- Bram77 - 2010-04-28

Quote:something like Player.GetInfo with the appropriate fields perhaps?
That sounds like the right place and the right method name Smile. Do you think the current volume percentage would fit in there?

Files.Getshares isn't working for me. But I think there is something wrong with the way I use api calls with multiple parameters or one parameter that has a name, because non of these call works. i.e.

Code:
{"jsonrpc":"2.0","method":"Playlist.Swap","params":{"playlist":"music","item1":2,"item2":1},"id":1}
Returns a "Invalid params" error (even though the playlist items do exist). And so does...

Code:
{"jsonrpc":"2.0","method":"Playlist.Remove","params":{"playlist":"music","item":3},"id":1}
To me it feels incosistent that sometimes 'music' is used as a prameter and most of the time 'audo'. What would be the downside in using 'audio' everywhere? The same goes for MusicLibrary, why not use AudioLibrary since the library can also contain non-music audio files.