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)



- othrayte - 2011-11-17

Blacksheep70 Wrote:A method to query if XBMC is currently idle (TRUE|FALSE) would be useful.

E.g. to trigger special actions or maintenance on smaller machines when there is no media playing.

I personally would use this method to shut down the system automatically after the system was brought up automatically (to record TV) via ACPI wakeup if no media is currently playing.

Regards,

Blacksheep
I can see that this concept might be useful to get the current state of xbmc when you start this other thing up, but wouldn't it be better to use xbmcs jsonrpc notifications to keep a track of what state xbmc is in.


- jasonvp - 2011-11-17

Montellese Wrote:Finally got around to fix this bug in https://github.com/xbmc/xbmc/commit/d187b1c2197c4477ba22f5364a3044cc1be46045 so it should now behave as you expect it to.

Thanks Montellese.


- dwagner - 2011-11-18

jimk72 Wrote:I was having all kinds of problems like this with tcp. also had large requests(all artist, ect..) would be sent back in random chunks. I ended up switching over to http post ect.. that way I get the full response and it is only that response and then use the tcp to monitor for notifications. Most of them are very short so a custom parser to make sure it is only one notification was easy. All my problems related to JSON ended after that Smile

I was considering this option, but was hoping it won't be necessary as I like the neatness of everything being handled in one communication stream.
I'd be interested to find out if there is any performance difference between using TCP where you have to manually parse to separate objects and using HTTP where you get the full response and hence not have to do the extra parsing. Guess I'll have to run a few timing tests. As every millisecond counts when your users have big libraries.


- topfs2 - 2011-11-18

dwagner Wrote:I was considering this option, but was hoping it won't be necessary as I like the neatness of everything being handled in one communication stream.
I'd be interested to find out if there is any performance difference between using TCP where you have to manually parse to separate objects and using HTTP where you get the full response and hence not have to do the extra parsing. Guess I'll have to run a few timing tests. As every millisecond counts when your users have big libraries.

http is over tcp so what you don't have to do in http is just hidden. Raw TCP is less data but http has the benefit of packaging it so that each character is not needed to be validated, you can however make that into an advantage by using stream parsing (or SAX-styled parsing). All in all I'd say they ought to be roughly the same but http being an easier starting point.


- jimk72 - 2011-11-21

I had preparsing using tcp to seperate all the json requests into individual commands and then send those to the json parser. It just seemed faster to use http. I am developing using delphi for windows os so speed isnt as important as compared to reliability. Once I load all the movies or albums or artists I save all that info localy in a file called movies.lst, albums.lst ect.. the thumbs are all saved localy too so once you run it the first time it is very fast after that initial load of all avail. Currently it only updates when u refresh it. My plan is to in the background do a call for the newest 10 of each and add them to the list and also possibly do a latest additions popup or something. this would get most things in the background for me as I usually only add 2-3 movies at a time and 1-2 albums at a time.


- grywnn - 2011-11-21

Hi there,

i think i found a bug(?) in Files.getDirectory:
When calling this with a ftp source as directory parameter, i only get subdirectories back, but no files.

Steps to reproduce (i hope):
- create a video source with ftp://<user>:<pass>@<host>/ as location
- call Files.getDirectory, params {"directory":"ftp://<user>:<pass>@<host>/"}
- Subdirectories are returned, video files are not. XBMC in file modeshows files correctly though.

Tested on OS X with yesterdays nightly.

Can anyone confirm this?


playlist.item play - vasikgreif - 2011-11-21

Hi, I cannot figure out the correct syntax for playing an item from playlist with Playlist.Item. Anyone could post an example? What I need is to start playback from a specified item in playlist. Thanks


- Montellese - 2011-11-23

grywnn Wrote:Hi there,

i think i found a bug(?) in Files.getDirectory:
When calling this with a ftp source as directory parameter, i only get subdirectories back, but no files.

Steps to reproduce (i hope):
- create a video source with ftp://<user>:<pass>@<host>/ as location
- call Files.getDirectory, params {"directory":"ftp://<user>:<pass>@<host>/"}
- Subdirectories are returned, video files are not. XBMC in file modeshows files correctly though.

Tested on OS X with yesterdays nightly.

Can anyone confirm this?
Sounds like a bug to me. Please create a bug ticket and provide a debug log.

vasikgreif Wrote:Hi, I cannot figure out the correct syntax for playing an item from playlist with Playlist.Item. Anyone could post an example? What I need is to start playback from a specified item in playlist. Thanks
Can you be more specific? Do you want to use Player.Open? If so you need to execude something like
Code:
{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "movieid": 25 } }, "id": 1 }
where you can replace "movieid" with "episodeid", "albumid" or some other database ID's (see http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v3#Playlist.Item for further details). And obviously you need to specify the database ID of the item you want to play.


- Mizaki - 2011-11-24

I had someone ask this question so I thought I'd check.

The input.select function doesn't bring up the menu ("m") when sent if something is playing. The "enter" key when pressed does. They were expecting the same behaviour. Should it be expected to act the same as the enter key?


- vasikgreif - 2011-11-25

Hi, I'm starting specific videos from playlist with:
Code:
{"id":45,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"playlistid":1,"position":3}}}
which works fine, but the problem is the main menu stays on top of the video. Because the XBMC machine is in another room, I won't have visual control, if the menu is displayed, and so I cannot simply press TAB. Is there any way to put the movie into front, or hide the menu? - I actually don't need the visual menu at all...

Thanks for help
Vasik


- Montellese - 2011-11-25

vasikgreif Wrote:Hi, I'm starting specific videos from playlist with:
Code:
{"id":45,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"playlistid":1,"position":3}}}
which works fine, but the problem is the main menu stays on top of the video. Because the XBMC machine is in another room, I won't have visual control, if the menu is displayed, and so I cannot simply press TAB. Is there any way to put the movie into front, or hide the menu? - I actually don't need the visual menu at all...

Thanks for help
Vasik

Hm I just tested it on my machine and it works perfectly fine. Here is what I did:
1. Go to TV Shows
2. Queue all episodes of a tv show (to get a video playlist)
3. Execute your jsonrpc request
4. The third episodes started in fullscreen

I repeated the above procedure and changed the locations I was in XBMC GUI when I executed the jsonrpc request to see if it makes a difference whether I'm on the home screen or in the playlist view or in the episode view but the episode always started in fullscreen.

Maybe you can provide more details about how you put together the playlist etc. A debug log would be helpful as well.


- vasikgreif - 2011-11-26

Montellese Wrote:Hm I just tested it on my machine and it works perfectly fine. Here is what I did:
1. Go to TV Shows
2. Queue all episodes of a tv show (to get a video playlist)
3. Execute your jsonrpc request
4. The third episodes started in fullscreen

I repeated the above procedure and changed the locations I was in XBMC GUI when I executed the jsonrpc request to see if it makes a difference whether I'm on the home screen or in the playlist view or in the episode view but the episode always started in fullscreen.

Maybe you can provide more details about how you put together the playlist etc. A debug log would be helpful as well.

Thanks for testing. I won't be at the XBMC machine till Monday to post the log, but for now, I build the playlist with: (with JS variables)
Code:
{"id":"+self.videoPlaylistAddID+","jsonrpc":"2.0","method":"Playlist.Add","params":{"playlistid":1,"item":{"movieid":"+self.movieid[movieNum]+"}}}
I don't use TV shows, could you try with videos? When I add videos to playlist, send my JSON request, only the first movie opens in fulscreen, all the next requests open movies in background with the menu on the top. I use todays nightly, on Linux.


- Montellese - 2011-11-26

Ah now I was able to reproduce. It only happens when sending the jsonrpc request while another video is playing. Thanks for the report I'll have to find out why this happens.


- Montellese - 2011-11-26

OK I found the problem but it's not an easy fix and I'm not even sure if it is a bug/problem. What you should actually do once you started playing a playlist is to use Player.GoTo to jump to another item in the same playlist. Player.Open is intended to start initial playback of an item or playlist and is not intended to be used to jump within a playlist. Because of that everytime you call Player.Open with a "playlistid" it creates the playlist from scratch which means extra work and time compared to using Player.GoTo if you "just" want to jump to another item in the existing playlist.


- vasikgreif - 2011-11-27

Thanks for info, I try this tomorrow and post back, how it went.