URL, LOGIN, Password
#1
Hi,
I'm using XBMC since few days, and it's quite interesting.
I installed in my house a whole solution to control my lights, dimmers, blinds through KNX and through my iPad.
I also developed a supervision MMI to control my lights, dimmers, blinds, AV Ampli, television... And now I want to add some functionalities to choose IN THIS APPLICATION movies, music hosted on my NAS and to play them using XBMC (installed on Raspberry PI model B)
I saw the webInterface.default provided by the XBMC team which is almost perfect because everything is done, I just have to provide other CSS and button locations.

The code is not going to be hosted on the XBMC itself, but it's going to be hosted on a remote apache2 server (in the same network of course). So I need to provide the URL, a login and a password to be able to interact with the XBMC server.
The point is that I don't understand where I can provide the URL and the options. I saw in the "XBMC.core.js" that this should be there "request_options.url = xbmc.core.JSON_RPC + '?' + options.method;"
But :
- I don't understand when this is called and by which program...
- I don't understand how I can provide the information such as : 192.168.0.10:1234 and a login and a password...

Does anyone can help me Smile
Thanks in advance
Reply
#2
You need to look into the JSON RPC API.

for example :

List Movies
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "playcount", "operator": "is", "value": "0"}, "limits": { "start" : 0, "end": 75 }, "properties" : ["art", "rating", "thumbnail", "playcount", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}
Play File
http://192.168.1.66:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "smb://serveur/movie/movie.mkv" } }, "id": 1 }
Currently Playing
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}
Pause Currently Playing
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 1 }, "id": 1}
Update Library
http://192.168.1.64:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}
Reply
#3
Hi,
Thanks for your reply... I understood that point, and it already tried to send request using this way...
The point is that I'd like to use the code provided in the webInterface.default, sending variables (eg: IP/Port/login/password) to a function (which one Huh And how Huh) located somewhere in the package (probably xbms.core.js)

I don't understand where I can provide these data...
Reply
#4
Hi all,

Here are the test I made on my system :
  • my XBMC Server is installed on a server with the IP Address 192.168.15.10
  • In System -> Services -> Web Server, I activated the WebServer on port 80, no username, no password
  • In System -> Services -> Remote Control, I allowed programs on the system AND on other systems to control XBMC

I check with a netstat -an that the port 9090 was LISTENING
on another machine, I launched a telnet session (telnet 192.168.15.10 9090) and I had the following result :
Trying 192.168.0.103...
Connected to 192.168.15.10.
Escape character is '^]'.


I entered the following JSON command :
http://192.168.15.10:9090/jsonrpc?request={"jsonrpc":"2.0","method":"Playlist.GetPlaylists","id":1}

I received the following result :
{"id":1,"jsonrpc":"2.0","result":[{"playlistid":0,"type":"audio"},{"playlistid":1,"type":"video"},{"playlistid":2,"type":"picture"}]}{"jsonrpc":"2.0","method":"GUI.OnScreensaverDeactivated","params":{"data":false,"sender":"xbmc"}}


As the communication worked, I modified the file "xbmc.core.js", and I hardcoded the JSON_RPC value, as show hereby :
xbmc.core = {
'DEFAULT_ALBUM_COVER': 'images/DefaultAlbumCover.png',
'DEFAULT_VIDEO_COVER': 'images/DefaultVideo.png',
'JSON_RPC': 'http://192.168.15.10:9090/jsonrpc',
'applyDeviceFixes': function () {
window.document.addEventListener('touchmove', function (e) {
e.preventDefault();
});
},


But when I try the code, I always have the error code : "Connection to server lost", as coded in the xbmc.core.js

Important behaviour :
  • I entered in a browser (Chrome, Firefox) the following command : http://192.168.15.10:9090/jsonrpc?request={"jsonrpc":"2.0","method":"Playlist.GetPlaylists","id":1} => Nothing Happens... Timeout
  • In Telnet, I tried to enter an invalid IP address : http://192.168.800.800:9090/jsonrpc?request={"jsonrpc":"2.0","method":"Playlist.GetPlaylists","id":1} => I always received the following result :
    {"id":1,"jsonrpc":"2.0","result":[{"playlistid":0,"type":"audio"},{"playlistid":1,"type":"video"},{"playlistid":2,"type":"picture"}]}{"jsonrpc":"2.0","method":"GUI.OnScreensaverDeactivated","params":{"data":false,"sender":"xbmc"}}


I don't understand what I did wrong... do you have any idea ?
Reply
#5
98 viewers... 1 answer... If I didn't explain correctly do not hesitate to tell me if this is the case...
As I'm not an expert, I sure the answer is really simple...

one more point... Instead of using the port 9090 for the request, i used the port 80...
in my browser, I received an answer
in the application, I still have the Error code "Connection to server lost"

Thanks again for your help
Reply

Logout Mark Read Team Forum Stats Members Help
URL, LOGIN, Password0