JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC

  Thread Rating:
  • 8 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Montellese Online
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1921
(2012-05-06 13:28)Mizaki Wrote:  To confirm all Player.OnPlay give the error:
Code:
Received unexpected continuation frame.
and closes the socket.

This should be fixed with https://github.com/xbmc/xbmc/commit/b8a3...1c3dbf3a5b and please let me know if you encounter any other problems with websockets.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Mizaki Offline
Fan
Posts: 726
Joined: Apr 2011
Reputation: 14
Post: #1922
Just trying with audio. Notifications have some problems:
Next: I get notified twice
Prev: I get Player.OnSeek. I realise why. Because it go to the beginning of the song.
Play/Pause: No notification.
FF/RW: Are fine. Either with pressing play or using the opposite to cancel the other.
Stop: Fine.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
(This post was last modified: 2012-05-13 00:22 by Mizaki.)
find quote
Montellese Online
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1923
Are you on a recent master build (specifically since AE has been merged)? Because gnif has re-written the whole PAPlayer (which handles music like mp3 etc) and it seems like he didn't really care about the callbacks used by XBMC to create the notifications in JSON-RPC, python etc. I noticed the same thing today and will let him know that he needs to re-add them where necessary.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Mizaki Offline
Fan
Posts: 726
Joined: Apr 2011
Reputation: 14
Post: #1924
Yes, AE. Do you want the video ones or wait for gnif?

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Montellese Online
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1925
The video ones should still work fine, at least they did when I used them to test my websocket fix.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Mizaki Offline
Fan
Posts: 726
Joined: Apr 2011
Reputation: 14
Post: #1926
I get VideoLibrary.OnUpdate notifications when using next or prev as well as the expected.
Code:
{"jsonrpc":"2.0","method":"Player.OnSeek","params":{"data":{"item":{"id":1874,"type":"episode"},"player":{"playerid":1,"seekoffset":{"hours":0,"milliseconds":-727,"minutes":0,"seconds":-17},"speed":1,"time":{"hours":0,"milliseconds":0,"minutes":0,"seconds":0}}},"sender":"xbmc"}}

{"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"id":2213,"type":"episode"},"player":{"playerid":1,"speed":1}},"sender":"xbmc"}}

{"jsonrpc":"2.0","method":"VideoLibrary.OnUpdate","params":{"data":{"item":{"id":1874,"type":"episode"}},"sender":"xbmc"}}
That's pressing previous twice. OnSeek goes to the beginning and looks fine and then when moving to play the previous video the OnUpdate as well.

I'd like to request notification of subtitles on/off and audio stream changes. Shall I do them separate or as one FR? Also, what are your thoughts on passing the current statuses when first opening a websocket? I can of course just request the current state manually but I was thinking it would be "nice" if on opening you received OnPlay if XBMC is playing.

And I guess the reason the vfs thumbnail etc. path is now wrong/not showing images is the work on the cache? Should I just ignore it for now?

Thanks.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
(This post was last modified: 2012-05-13 16:48 by Mizaki.)
find quote
Montellese Online
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1927
(2012-05-13 16:47)Mizaki Wrote:  I get VideoLibrary.OnUpdate notifications when using next or prev as well as the expected.
Code:
{"jsonrpc":"2.0","method":"Player.OnSeek","params":{"data":{"item":{"id":1874,"type":"episode"},"player":{"playerid":1,"seekoffset":{"hours":0,"milliseconds":-727,"minutes":0,"seconds":-17},"speed":1,"time":{"hours":0,"milliseconds":0,"minutes":0,"seconds":0}}},"sender":"xbmc"}}

{"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"id":2213,"type":"episode"},"player":{"playerid":1,"speed":1}},"sender":"xbmc"}}

{"jsonrpc":"2.0","method":"VideoLibrary.OnUpdate","params":{"data":{"item":{"id":1874,"type":"episode"}},"sender":"xbmc"}}
That's pressing previous twice. OnSeek goes to the beginning and looks fine and then when moving to play the previous video the OnUpdate as well.
That's probably because XBMC updates the "playcount" property in the database so you'll get the VideoLibrary.OnUpdate notification.

(2012-05-13 16:47)Mizaki Wrote:  I'd like to request notification of subtitles on/off and audio stream changes. Shall I do them separate or as one FR?
Please create seperate feature requests on trac. There's also subtitle changes not only on/off.

(2012-05-13 16:47)Mizaki Wrote:  Also, what are your thoughts on passing the current statuses when first opening a websocket? I can of course just request the current state manually but I was thinking it would be "nice" if on opening you received OnPlay if XBMC is playing.
You can create a feature request for it but it will probably be very far down on my todo list.

(2012-05-13 16:47)Mizaki Wrote:  And I guess the reason the vfs thumbnail etc. path is now wrong/not showing images is the work on the cache? Should I just ignore it for now?
Yup, they should be fixed as soon as we merge PR958. There will also be a new way to retrieve images through the webserver because we plan to get rid of the access through /vfs/.... to get more control over what can be accessed through the webserver. But for a while both the "old" /vfs/... and the new /image/... access will work.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Tolriq Offline
Donor
Posts: 2,320
Joined: Jun 2009
Reputation: 68
Location: France
Post: #1928
This mean you won't extend http to support partial request for easy streaming ? :'(

Yatse 2 : Media Center Remote Control for Touch Screens
Yatse, the Xbmc Remote and Widgets for Android
find quote
Montellese Online
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1929
(2012-05-13 20:50)Tolriq Wrote:  This mean you won't extend http to support partial request for easy streaming ? :'(

Hm where/when did I say that? I just said that the access to the VFS will be removed from the webserver because it is as big a security hole as it can get.
When someone adds support for video/music streaming it will (most likely) be done with a streaming-specific handler in the webserver which will support all the necessary things for real streaming and not some half-arsed implementation through the VFS.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Tolriq Offline
Donor
Posts: 2,320
Joined: Jun 2009
Reputation: 68
Location: France
Post: #1930
It's clear vfs is not gootd but not sure http streaming will come soon Smile

Not talking about access to cd-art or download of the trailers when available.

Was just wondering of how the transition will come, not more.

Yatse 2 : Media Center Remote Control for Touch Screens
Yatse, the Xbmc Remote and Widgets for Android
find quote
Mizaki Offline
Fan
Posts: 726
Joined: Apr 2011
Reputation: 14
Post: #1931
(2012-05-13 20:41)Montellese Wrote:  That's probably because XBMC updates the "playcount" property in the database so you'll get the VideoLibrary.OnUpdate notification.

The DB has zero for "watchedcount" on all tvshowview and episodeview so I don't think it's that.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Montellese Online
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1932
IIRC the logic for sending the notification is pretty stupid. It doesn't really check if anything has changed. So if playcount is updated from 0 to 0 it still sends the notification as long as the update method is called.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Mizaki Offline
Fan
Posts: 726
Joined: Apr 2011
Reputation: 14
Post: #1933
I think it must be lastPlayed as I've just noticed the episodes I was testing with have it filled in. Obviously doesn't follow the same >80% counts as watched rule.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Montellese Online
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1934
Ah that sounds right. I forgot about lastPlayed.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Montellese Online
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1935
Monday, May 14th 2012:
Commit: 1e16f6f66c96f70bfdb7
These commits solve the problem of retrieving thumbnails and fanart provided by JSON-RPC after introducing the new texture caching functionality in the video library. With the new cache XBMC uses image://<path-to-real-file> URLs to relate to images. Currently this only is implemented for video artwork, music artwork still uses the old special://<some-path> URLs but they should both work. We used this opportunity to introduce a new image handler in the webserver which is meant to replace the existing VFS handler someday in the near future. This means that images can and should from now on be retrieved using the following HTTP URL: http://<ip>:<port>/image/<url-encoded-image-path> where <url-encoded-image-path> can either be a image://- or a special://-based URL. It is very important that the whole image-URL provided by JSON-RPC is URL-encoded because otherwise it will result in an invalid URL and will not work. If you're not sure what the resulting URL should look like, take a image-URL returned by JSON-RPC and use Files.PrepareDownload to retrieve the actual URL you should call. For the time being you can still use the "old" VFS handler but we plan to remove it because it is a huge security risk/hole.

As always feel free to ask if you have any questions/problems.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Post Reply