Release - Library to query xbmc via websockets

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
D0nR0s4 Offline
Senior Member
Posts: 278
Joined: Nov 2009
Reputation: 0
Location: Germany
Post: #1
Hi,
I posted this over in a thread in Supplementary Tools, but I think this might be pretty useful here, too.
(I hope noone mistakes this for spamming, if it is, I would like to ask one of the mods to move the other thread from there to here. Thanks)

This is a library some of you who want to write web-interfaces for xbmc might like to use.
It allows for very easy use of xbmcs JSONRPC api via websockets.

It is as simple as including a single .js file on your site and then doing something like this:

Code:
var connection = xbmc(window.location.hostname, 9090);
connection.run('VideoLibrary.GetMovies')(['title', 'rating', 'year'], {"start" : 0, "end": 2}, handleMovies);

Where handleMovies is a function which does something with the query result.

I hope this helps someone, and I would love to hear some feedback on this.
find quote
danmedhurst Online
Fan
Posts: 384
Joined: Jul 2008
Reputation: 2
Post: #2
I Might be being dumb but why is this better than just sending a JSON query via the API?

[Image: 993659535.png]
find quote
D0nR0s4 Offline
Senior Member
Posts: 278
Joined: Nov 2009
Reputation: 0
Location: Germany
Post: #3
This is actually sending a json query to the api and receiving a result. But currently (at least as far as I was able to tell), most web interfaces use jquery or something similar to query via ajax and then handle the response. I think (unless I missed something), that this solution saves lines of code within the interfaces main js files.
find quote
danmedhurst Online
Fan
Posts: 384
Joined: Jul 2008
Reputation: 2
Post: #4
(2013-11-23 23:40)D0nR0s4 Wrote:  This is actually sending a json query to the api and receiving a result. But currently (at least as far as I was able to tell), most web interfaces use jquery or something similar to query via ajax and then handle the response. I think (unless I missed something), that this solution saves lines of code within the interfaces main js files.

Cool.. so i use a web interface that i've written myself to query the sql db and then play the movies using json commands.. but when i issue the command i end up on a white page with a string result for the command.. does this return something nicer?

[Image: 993659535.png]
find quote
D0nR0s4 Offline
Senior Member
Posts: 278
Joined: Nov 2009
Reputation: 0
Location: Germany
Post: #5
Hey, could you show me what exactly you are doing, or how you are calling the lib?
find quote
danmedhurst Online
Fan
Posts: 384
Joined: Jul 2008
Reputation: 2
Post: #6
(2013-12-04 13:00)D0nR0s4 Wrote:  Hey, could you show me what exactly you are doing, or how you are calling the lib?

I'm sending this command from a hyperlink :

http://192.168.1.68:81/jsonrpc?request={...0Scared%20[2006%20BluRay].mkv%22%20}%20},%20%22id%22:%201%20}

[Image: 993659535.png]
find quote