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

  Thread Rating:
  • 7 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Montellese Online
Team-XBMC Developer
Posts: 2,789
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #1891
Tuesday, May 1st 2012:
Commit: 5cc59fd88149927ae708
  • added "lastplayed" property for songs

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: 663
Joined: Apr 2011
Reputation: 12
Post: #1892
With streaming audio the skins can pick up additional information (such as artist and song name). Is it possible to make that available? Atm all you get is the name of the stream as the label.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,789
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #1893
With what version of XBMC and the JSON-RPC API did you try this? I added the following commit a while back which should provide more info for non-library items through Player.GetItem: https://github.com/xbmc/xbmc/commit/73fd...32648b3110

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: 663
Joined: Apr 2011
Reputation: 12
Post: #1894
This is in Eden. I just tried it in Frodo and get the same. For reference:
Code:
{"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist", "duration", "thumbnail", "file", "fanart", "streamdetails"], "playerid": 0 }, "id": 1}
Code:
{"id":1,"jsonrpc":"2.0","result":{"item":{"fanart":"special://masterprofile/Thumbnails/Video/Fanart/515043c5.tbn","file":"shout://streamer-dtc-aa01.somafm.com:80/stream/1018","label":"SomaFM Groove Salad","thumbnail":"","title":"","type":"unknown"}}}

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,789
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #1895
Friday, May 4th 2012:
Commit: 0bd7924d87f00059a9b4
  • added SetArtistDetails, SetAlbumDetails and SetSongDetails to the AudioLibrary namespace
  • added SetMovieDetails, SetTVShowDetails. SetEpisodeDetails and SetMusicVideoDetails to the VideoLibrary namespace
  • added RemoveMovie, RemoveTVShow, RemoveEpisode and RemoveMusicVideo to the VideoLibrary namespace

I'll update the wiki page on JSON-RPC API v5 ASAP but make sure to take a close look at the JSON schema for the SetFooDetails methods so you don't mess up your (and possibly other people's) libraries Wink

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: 663
Joined: Apr 2011
Reputation: 12
Post: #1896
Nice. Fingers crossed for webserver: image transformation handler soon Smile

I'm using Frodo with Firefox and I think the Content-Type change has broken things. It appears that Firefox adds "; charset=UTF-8" to the Content-Type. Bug report. Chrome and IE don't do this and all the JSONRPC requests work fine. Same thing in Firefox gives:
Code:
NetworkError: 415 Unsupported Media Type
from FireBug. Anything you can do on the web server end because Mozilla won't?

Did you get a chance to check on the details of audio web streams whilst I'm here?

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,789
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #1897
(2012-05-04 18:06)Mizaki Wrote:  Nice. Fingers crossed for webserver: image transformation handler soon Smile
jmarshall claimed that PR and will adjust it's implementation so might still be a while.

(2012-05-04 18:06)Mizaki Wrote:  I'm using Frodo with Firefox and I think the Content-Type change has broken things. It appears that Firefox adds "; charset=UTF-8" to the Content-Type. Bug report. Chrome and IE don't do this and all the JSONRPC requests work fine. Same thing in Firefox gives:
Code:
NetworkError: 415 Unsupported Media Type
from FireBug. Anything you can do on the web server end because Mozilla won't?
Should be fixed with https://github.com/xbmc/xbmc/commit/75fd...cb9784be76

(2012-05-04 18:06)Mizaki Wrote:  Did you get a chance to check on the details of audio web streams whilst I'm here?
As I don't use any audio web streams or similar addons it always takes me a while to look into those things.

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: 663
Joined: Apr 2011
Reputation: 12
Post: #1898
That's great, thanks. I don't use them either but Martijn was bugging me Smile

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
sjroesink Offline
Junior Member
Posts: 4
Joined: May 2012
Reputation: 0
Post: #1899
I'm having trouble finding out how the websocket functionality works.
Maybe it lacks documentation because websocket support is pretty new (and maybe unstable), but it would be great if someone could point me in the right direction.

Thusfar I've got the following:

Code:
var xbmcSocket = new WebSocket('ws://localhost:9090/jsonrpc');
xbmcSocket.onopen = function() {
    console.log('xbmcSocket.open');
};
xbmcSocket.onmessage = function(msg) {
    console.log('xbmcSocket.onmessage', msg);
};
So far so good: I now receive XBMC events.

Now I would also like to send commands using the websocket. So my initial though was:
Code:
xbmcSocket.send({
    "id": 1,
    "jsonrpc": "2.0",
    "method": "JSONRPC.Introspect"
});
However, this gives the following parse error:
Code:
{
    "error": {
        "code": -32700,
        "message": "Parse error."
    },
    "id": null,
    "jsonrpc": "2.0"
}
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,789
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #1900
You are probably the first to try and use the new websocket functionality (after me) so first thanks for the feedback. Have you tried other JSON-RPC methods like JSONRPC.Ping etc? I have to admit that JSONRPC.Introspect is a bit of a loose candidate depending on the browser/websocket-implementation is used because of the huge amount of data it returns. During my testing I found out that there are browsers who can handle literally any amount of result data you throw at them while others have a fixed limit (which is pretty stupid considering that WebSocket supports fragmented messages).

Thanks again for the feedback.

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