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 - Mizaki - 2012-05-06 23:40

Done.

Artists isn't so much of a problem as I do the same the skins and require people to enter the path.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - N3MIS15 - 2012-05-07 08:16

(2012-05-06 13:28)Mizaki Wrote:  To confirm all Player.OnPlay give the error:
Code:
Received unexpected continuation frame.
and closes the socket.
Same here.

Using python websocket client lib i get
Code:
string index out of range
Also happens on ffd/seek


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - sjroesink - 2012-05-07 13:40

(2012-05-07 08:16)N3MIS15 Wrote:  
(2012-05-06 13:28)Mizaki Wrote:  To confirm all Player.OnPlay give the error:
Code:
Received unexpected continuation frame.
and closes the socket.
Same here.

Using python websocket client lib i get
Code:
string index out of range
Also happens on ffd/seek

Yeah, this is very annoying.

@Montellese: this error seems to occur when the message contains 0x00 (new line perhaps?)

For those interested: websockets can be debugged using fiddler (see the Log tab). The only problem is that fiddler throws an exception when the error "Received unexpected continuation frame" occurs:
Quote:13:35:29:0439 [WebSocket #222] Server->Client (150 bytes)
TYPE: TEXT.
MESSAGE: 13:35:29:0468 [WebSocket #222] Read from Client returned error: 0
13:35:29:0898 Close WebSocket Tunnel: at System.Environment.get_StackTrace()
at Fiddler.WebSocket.CloseTunnel()
at Fiddler.WebSocket.OnClientReceive(IAsyncResult ar)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
13:35:29:0917 [WebSocket #222] Read from Server failed... Object reference not set to an instance of an object.
13:35:29:0927 Close WebSocket Tunnel: at System.Environment.get_StackTrace()
at Fiddler.WebSocket.CloseTunnel()
at Fiddler.WebSocket.OnRemoteReceive(IAsyncResult ar)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-05-11 21:04

Hello,

2 little questions Smile

Why is VideoLibrary.GetSeasons parameter tvshowid mandatory when it's not the case for GetEpisodes for examples. Getting all seasons for all shows makes a lot's of requests when it's not needed for episodes (and it's good Tongue)

And other one about performances, it seems on some low end Xbmc machine a query that will return more than 1000 results will be really really really really .... slow, is it due to slow database or too much data to encode to Json ?
(Well the final question is : Does putting limits to query to get bunch of say 500 items will be quicker or slower).


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-05-11 21:17

(2012-05-11 21:04)Tolriq Wrote:  Why is VideoLibrary.GetSeasons parameter tvshowid mandatory when it's not the case for GetEpisodes for examples. Getting all seasons for all shows makes a lot's of requests when it's not needed for episodes (and it's good Tongue)
Because up until a few days ago XBMC didn't really store seasons. It just stored tvshows and episodes and then season were deduced from the episodes. That's also why there is no "seasonid" (compared to "tvshowid" and "episodeid") so XBMC doesn't offer a method to retrieve all seasons (and IMO it doesn't really make any sense either).

(2012-05-11 21:04)Tolriq Wrote:  And other one about performances, it seems on some low end Xbmc machine a query that will return more than 1000 results will be really really really really .... slow, is it due to slow database or too much data to encode to Json ?
(Well the final question is : Does putting limits to query to get bunch of say 500 items will be quicker or slower).
It's because of the database queries. Especially if you retrieve properties like "cast" or "resume" or "set" it will get really slow because it has to do an extra query for every retrieved item. Currently it also won't be faster if you put a limit on the item retrieval but I have some unfinished work which will improve that.

So the best you can do is not to retrieve those properties I mentioned (they are also mentioned in introspect so you might wanna check there because I might have forgotten one or two) when using FooLibrary.GetFoo and only retrieve those properties with FooLibrary.GetFooDetails.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-05-11 21:33

Well yes getting all seasons does not makes sense but Xbmc is really stupid on season thumbs Smile Since the thumb can't be calculated because of language translations (ie the thumb value change if you change xbmc language ....) it's very hard to get them, so the GetSeasons is great for that and creating seasons from episodes does not work Sad
For full datasync for off-line browsing getting allseasons of all show in one query is interesting for remote writers.

About performances for example for audio songs I only get : DetailsSong.ALBUM, DetailsSong.TRACK, DetailsSong.ALBUMID, DetailsSong.ARTISTID, DetailsSong.ALBUMARTIST, DetailsSong.DURATION, DetailsSong.THUMBNAIL, DetailsSong.GENRE, DetailsSong.TITLE, DetailsSong.ARTIST, DetailsSong.YEAR those should not slow the query.
But on some Xbmc it can takes more than 30sec to get the result for 20k songs. (And I really mean 30 secs to get the first { not to download the data).


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - jmarshall - 2012-05-12 04:34

Tolriq: Also merged in the May window was moving video thumbs to the texture cache. No more silly storage techniques for them now. Smile

ATM they're not retrievable over the webserver - Montellese and I are deciding the best way to get them there (backward compatibility concerns + how to best move away from using the VFS for it) at the moment, so I expect that it will be ironed out in the next week or so.

Cheers,
Jonathan


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

(2012-05-11 21:33)Tolriq Wrote:  About performances for example for audio songs I only get : DetailsSong.ALBUM, DetailsSong.TRACK, DetailsSong.ALBUMID, DetailsSong.ARTISTID, DetailsSong.ALBUMARTIST, DetailsSong.DURATION, DetailsSong.THUMBNAIL, DetailsSong.GENRE, DetailsSong.TITLE, DetailsSong.ARTIST, DetailsSong.YEAR those should not slow the query.
But on some Xbmc it can takes more than 30sec to get the result for 20k songs. (And I really mean 30 secs to get the first { not to download the data).

Well 20k songs is a lot of data to retrieve from the database and to write into JSON and will result in a huge JSON-RPC response. If the machine is an ATV or something like that it will take a while. The best solution to get around this would be to only retrieve e.g. 200 songs with one request so you can already display those but that approach currently doesn't make it faster, but like I said I'm working on that.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-05-12 11:34

Good news for the texture cache Smile This will also allow easy cleanup.
I hope the new out of VFS way will still allow to get multiple thumb at once.

About songs or other big data, the final goal is not to just display but but make full database sync, for off-line remote browsing for example.
This will be less a problem in Frodo due to dateAdded and such new fields but not an easy task in Eden.

Is there a timeout in Xbmc Web Server part that would make such very long request to fail ? Like 60s or something ? I think I'll stick to get a full data request since you said it would be slower to get multiple request and I can play with read uncommitted on my client side.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-05-12 17:13

(2012-05-12 11:34)Tolriq Wrote:  Good news for the texture cache Smile This will also allow easy cleanup.
I hope the new out of VFS way will still allow to get multiple thumb at once.
What do you mean by "get multiple thumbs at once"? Multiple HTTP requests in parallel? That will not change.

(2012-05-12 11:34)Tolriq Wrote:  Is there a timeout in Xbmc Web Server part that would make such very long request to fail ? Like 60s or something ?
XBMC's webserver has a timeout of 24 hours Wink but your browser or your HTTP implementation may have it's own timeout.