2012-05-01, 00:47
2012-05-01, 18:02
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.
2012-05-01, 18:44
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
2012-05-01, 20:40
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"}}}
2012-05-04, 17:02
Friday, May 4th 2012:
Commit: 0bd7924d87f00059a9b4
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
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
2012-05-04, 18:06
Nice. Fingers crossed for webserver: image transformation handler soon
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:
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?
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
Did you get a chance to check on the details of audio web streams whilst I'm here?
2012-05-04, 23:47
(2012-05-04, 18:06)Mizaki Wrote: Nice. Fingers crossed for webserver: image transformation handler soonjmarshall 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:Should be fixed with https://github.com/xbmc/xbmc/commit/75fd...cb9784be76
from FireBug. Anything you can do on the web server end because Mozilla won't?Code:NetworkError: 415 Unsupported Media Type
(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.
2012-05-06, 10:04
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:
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:
However, this gives the following parse error:
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);
};
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"
});
Code:
{
"error": {
"code": -32700,
"message": "Parse error."
},
"id": null,
"jsonrpc": "2.0"
}
2012-05-06, 10:13
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.
Thanks again for the feedback.
2012-05-06, 10:26
Thanks for the fast response.
I did try other methods. They all give the same parse error.
Is there any way I can provide more information to make the debugging easier? I'm not sure how to debug websockets.
I did try other methods. They all give the same parse error.
Is there any way I can provide more information to make the debugging easier? I'm not sure how to debug websockets.
2012-05-06, 11:15
Neither am I. I just ran latest XBMC (from master not a nightly build, but shouldn't make a difference) and used the websocket demo on websocket.org, opened a websocket to XBMC and ran JSONRPC.Ping, JSONRPC.Version and VideoLibrary.GetMovies without a problem.
EDIT: What browser are you using and are you using any framework for websockets?
EDIT: What browser are you using and are you using any framework for websockets?
2012-05-06, 11:34
When using Firefox, I can't get the websocket.org demo to connect to the websocket. In Chrome I can.
Via the demo I found out I had to send the JSON encoded string instead of the actual object (I tried this before using the Introspect method, but this gave me the error "Received unexpected continuation frame."):
This does work!
BTW: The error "Received unexpected continuation frame." also occurs when I start playing a movie.
Via the demo I found out I had to send the JSON encoded string instead of the actual object (I tried this before using the Introspect method, but this gave me the error "Received unexpected continuation frame."):
Code:
var xbmcSocket = new WebSocket('ws://localhost:9090/jsonrpc');
xbmcSocket.onopen = function() {
console.log('xbmcSocket.open');
xbmcSocket.send(JSON.stringify({
"id": 1,
"jsonrpc": "2.0",
"method": "JSONRPC.Ping"
}));
};
xbmcSocket.onmessage = function(msg) {
console.log('xbmcSocket.onmessage', msg);
};
This does work!
BTW: The error "Received unexpected continuation frame." also occurs when I start playing a movie.
2012-05-06, 11:44
That's funny. I was just about to post I was having problems. I've been trying on and off for a few days, I'm doing basically the same thing but I don't get a connection. It tries to open and then after a while I get a closed message and error "Firefox can't establish a connection to the server at ws://10.0.0.101:9090/jsonrpc". Here is the simple code:
I can't see what I'm doing wrong. Seems rather simple... I've allowed everything in network just in case. Any ideas? I've tried FF and Chrome.
EDIT: Just thought I'd try the websocket.org demo. Works in Chrome but not in FF. Error in log:
EDIT, EDIT: Okay and now Chrome is working fine. Maybe because I just allowed UPnP access?
I'll leave all this here for any searchers it might help.
Code:
wsListener: function() {
if ("WebSocket" in window) {
var wsConn = 'ws://' + location.hostname + ':9090/jsonrpc';
console.log(wsConn);
var ws = new WebSocket(wsConn);
console.log(ws);
ws.onopen = function (e) {
console.log('socket open');
ws.send('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties" : ["thumbnail"]}, "id": 1}');
};
ws.onerror = function (err) {
console.log(err);
};
ws.onmessage = function (e) {
console.log(e.data);
};
ws.onclose = function (e) {
console.log('socket close');
};
};
}
EDIT: Just thought I'd try the websocket.org demo. Works in Chrome but not in FF. Error in log:
Code:
10:39:44 T:2874841968 INFO: WebSocket [RFC6455]: invalid "connection" received
10:39:44 T:2874841968 INFO: WebSocket: No frame expected in the current state
EDIT, EDIT: Okay and now Chrome is working fine. Maybe because I just allowed UPnP access?
I'll leave all this here for any searchers it might help.
2012-05-06, 11:59
Ah right I thought the websocket send method would take care of the stringification of the JSON object. Yes a websocket is just an extended TCP socket so you'll need to pass in everything as a string.
Back when I implemented this there was no browser who supported the final RFC6455 implementation yet so I could only test against the latest draft. Maybe there's a bug in there.
The only thing you should have to enable in the settings is "Allow programs on this system to control XBMC" (and "Allow programs on other systems to control XBMC" if that's what you want)).
Back when I implemented this there was no browser who supported the final RFC6455 implementation yet so I could only test against the latest draft. Maybe there's a bug in there.
The only thing you should have to enable in the settings is "Allow programs on this system to control XBMC" (and "Allow programs on other systems to control XBMC" if that's what you want)).