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)



- giftie - 2011-04-06

Montellese Wrote:Everyone interested in JSON RPC please read http://forum.xbmc.org/showthread.php?p=767487 carefully.

Awesome work Montellese! That was a big undertaking... And it didn't break my Addon Laugh Or should I say, my addon survived.. Big Grin


- carmenm - 2011-04-06

Montellese Wrote:Do you mean info of tv episodes? Because a playlist item can not be a tv show, but only a tv episode. "genre" and "tagline" are no valid fields for a tv episode but "runtime" and "rating" are. Please create a bug ticket so I don't forget about it.

EDIT: I just tested it and it works fine for me. For some reason I get an empty string for "runtime" but that also happens when calling VideoLibrary.GetEpisodes. The "rating" values show fine on VideoPlaylist.GetItems for me.

Yes i was talking about tvepisode. ok for genre and tagline.
I added the bug

THanks


- marksoccer - 2011-04-06

Thanks for the new JSON API update. It looks like there are a bunch of new features I've been waiting for. However, I am having difficulty getting any audio items to play. Looking through introspect, I see XBMC.PLAY requires a filename now instead of accepting Playlist.Audio.Item. I tried using AudioPlaylist.Add and AudioPlaylist.Insert and received successful replies, but I still could not get the audio to play. Specifically, I am looking to provide an artistid and be able to play all the songs by that artist. Thanks again for all your hard work Smile


- carmenm - 2011-04-06

Is there a way with json to know if (or when) the videoPlayer switch from fullscreen to "show gui"?

i have buttons that have different actions depending if on videoplayer or gui. For now i was relying on VideoPlayer playing status. But i just realized that i had the problem of the "show gui" during playback Confused

THanks


- Montellese - 2011-04-06

marksoccer Wrote:However, I am having difficulty getting any audio items to play. Looking through introspect, I see XBMC.PLAY requires a filename now instead of accepting Playlist.Audio.Item. I tried using AudioPlaylist.Add and AudioPlaylist.Insert and received successful replies, but I still could not get the audio to play. Specifically, I am looking to provide an artistid and be able to play all the songs by that artist. Thanks again for all your hard work Smile
I removed all the parameters which caused some problems or didn't always work properly. If I have the time to fix them the parameters will be re-added.
Did you try to run AudioPlaylist.Play() after using AudioPlaylist.Add? AudioPlaylist.Play() expects a parameter "item" which indicates the position of the item in the playlist to start playing.

carmenm Wrote:Is there a way with json to know if (or when) the videoPlayer switch from fullscreen to "show gui"?
There is no direct support in json rpc for any gui states but maybe you are lucky and find an InfoLabel (check the wiki) which can do this.


- carmenm - 2011-04-06

Thanks for the info Montellese.

By the way would it be possible to recover the movieid with VideoPlaylist.GetItems?
should i add a feature request? (dont want to add it if not possible)


- Montellese - 2011-04-06

carmenm Wrote:Thanks for the info Montellese.

By the way would it be possible to recover the movieid with VideoPlaylist.GetItems?
should i add a feature request? (dont want to add it if not possible)

It would be possible but how would you know whether the id is for a movie, tv episode or a musicvideo. That would require an extra field and internal discussions resulted in postponing this issue until later. The primary goal was to get our json rpc api compliant with the 2.0 specification and to introduce the enhanced introspect and error messaging as that should make it a lot easier for 3rd party developers to use our API.


- carmenm - 2011-04-06

and what about a getMovieDetails using file path? would it be possible?
That would be enough. And it would solve the not knowing if episode/movie/musicvideo.


- topfs2 - 2011-04-06

carmenm Wrote:Is there a way with json to know if (or when) the videoPlayer switch from fullscreen to "show gui"?

I say put a ticket on this, we should notify on window change no matter and we could probably notify on player going to from fullscreen also, I agree its a nice state to track. For sure a good idea to have remotes look different when in fullscreen and when in GUI, so whatever makes that easier is good Smile

Cheers,
Tobias.


- Manromen - 2011-04-06

Hi,

Since the API update I get an error with this json command:
Quote:{'jsonrpc': '2.0', 'method': 'VideoLibrary.GetMovies','params':{'fields': ['title', 'year', 'originaltitle', 'imdbnumber', 'playcount', 'lastPlayed']}, 'id': 1}

I don't get it, why I receive this error:
Quote:{u'jsonrpc': u'2.0', u'id': 1, u'error': {u'message': u'Invalid params.', u'code': -32602, u'data': {u'method': u'VideoLibrary.GetMovies', u'stack': {u'message': u'array expected for array element at index 5 but array received', u'property': {u'message': u'Received value does not match any of the defined enum values', u'type': u'string'}, u'type': u'array', u'name': u'fields'}}}}

Any idea ?


- jitterjames - 2011-04-06

I understand that execbuiltin is not in the spirit of the JSON interface for XBMC, but there are certain functions that *we* basically can't live without. (some, like the first are just http api commands)

- AddToPlayListFromDB (this one is huge for me - without it my voice control app is essentially broken)
- Activate Window()
- call an addon/script with a parameter (just having this might allow workarounds for other missing things)
- commands like Container.PreviousViewMode,Container.SetViewMode(id)
- sendkeys (it would be nice if we could send modified keys like "shift-F" there is currently no way to do this, not even with keyboard emulation because xbmc won't release the shift key)
- Skin.ToggleSetting(setting), Skin.SetBool(setting), ReloadSkin()

...and quite a bit more. I am happy to submit them all via trac, but I wanted to get some feedback first.

- Are some of these already possible?
- Have they already been rejected?
- Can I submit a big list to trac or is it better to submit a request for each item?

There are many other things that would make my voice control app way better (but that would benefit others as well) such as a command to filter the current list of items on various fields, jump to an item (by name or id) etc. I am currently sort of managing to do this by sending a sequence of sms keys, but to be honest, this method kind of sucks, especially since we can only filter on a single word, and jumping to a letter will jump past it and do other weird things if the list doesn't contain any items that start with that letter.

It might also be nice to be able to get a list of items on screen (eg. all the movies on the current view). Perhaps accessed in the same basic manner as a playlist.

Like I said, I can submit all these via the proper channels but I wanted to get a general sense of what would be possible. From what I can see, if I lost access to the http api and had to use what was in the JSON spec. now my program would not be worth using with XBMC any more.


- topfs2 - 2011-04-06

jitterjames Wrote:- AddToPlayListFromDB (this one is huge for me - without it my voice control app is essentially broken)
You can add anything to the playlists, movies, tvshows whatever. Just as you would get them. i.e. VideoPlaylist.Add(tvshowid = 12)
jitterjames Wrote:- Activate Window()
- call an addon/script with a parameter (just having this might allow workarounds for other missing things)
- commands like Container.PreviousViewMode,Container.SetViewMode(id)
- sendkeys (it would be nice if we could send modified keys like "shift-F" there is currently no way to do this, not even with keyboard emulation because xbmc won't release the shift key)
- Skin.ToggleSetting(setting), Skin.SetBool(setting), ReloadSkin()

...and quite a bit more. I am happy to submit them all via trac, but I wanted to get some feedback first.

- Are some of these already possible?
- Have they already been rejected?
- Can I submit a big list to trac or is it better to submit a request for each item?

There are many other things that would make my voice control app way better (but that would benefit others as well) such as a command to filter the current list of items on various fields, jump to an item (by name or id) etc. I am currently sort of managing to do this by sending a sequence of sms keys, but to be honest, this method kind of sucks, especially since we can only filter on a single word, and jumping to a letter will jump past it and do other weird things if the list doesn't contain any items that start with that letter.

It might also be nice to be able to get a list of items on screen (eg. all the movies on the current view). Perhaps accessed in the same basic manner as a playlist.

Like I said, I can submit all these via the proper channels but I wanted to get a general sense of what would be possible. From what I can see, if I lost access to the http api and had to use what was in the JSON spec. now my program would not be worth using with XBMC any more.

Please submit them as feature requests, please do one ticket for each method you want with as much information as possible. i.e. Full description how you want the params and the expected results in as many cases as possible. Names and namespaces and permissions would also be very good.

Cheers,
Tobias


- Montellese - 2011-04-06

Manromen Wrote:Any idea ?

It should be "lastplayed" and not "lastPlayed" but I'll have to think about whether it makes sense to change it to case insensitive or not.


- jitterjames - 2011-04-06

topfs2 Wrote:You can add anything to the playlists, movies, tvshows whatever. Just as you would get them. i.e. VideoPlaylist.Add(tvshowid = 12)

yes, but audioplaylist.add only appears to allow us to add a single item, So how would we add

- All songs by artist "xyz"
- All songs with genre "rock"
etc

it seems that I would need to request all items in the library and then filter them myself and then add each on individually by id. That doesn't seem very efficient to me, but maybe I misunderstand.


- Manromen - 2011-04-06

Montellese Wrote:It should be "lastplayed" and not "lastPlayed" but I'll have to think about whether it makes sense to change it to case insensitive or not.

Ah thank you, that was the problem. Smile