Author Topic: Possible to use vox with http api? XBMC  (Read 20871 times)

0 Members and 1 Guest are viewing this topic.

apichai

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
    • View Profile
Possible to use vox with http api? XBMC
« on: June 30, 2010, 12:12:55 AM »
Possible to use vox with  http api?

i found

JSON-RPC (remote procedure call protocol interface) in development for XBMC

API commands QueryMusicDatabase, QueryVideoDatabase

Apichai

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Possible to use vox with http api? XBMC
« Reply #1 on: June 30, 2010, 08:19:47 AM »
YES!

Currently I am able to use VC with XBMC via the http interface.  It is very easy to implement basic commands like what you could do with a remote.  I am not too sure about more advanced commands like play artist "blah blah" though I'm pretty sure it's possible.

but the http interface is not being developed any more as mentioned in the link you sent me, so I guess it would be better to try to use the JSON-RPC interface.  The only problem is that I don't know anything about JSON.  Do you have any experience with it?  I looks like I may need to get some kind of library for c# to do JSON-rpc.  (VS is coded in c#)

do you want me to try to get you set up with the regular http interface?  I need to add some stuff to the options page (xbmc i.p. port etc.) and would probably require that we not use a password for the xbmc web server for now.

apichai

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
    • View Profile
Re: Possible to use vox with http api? XBMC
« Reply #2 on: June 30, 2010, 08:52:22 AM »
Great,

Looking forward to test this.

apichai

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Possible to use vox with http api? XBMC
« Reply #3 on: June 30, 2010, 05:27:40 PM »
Great,

Looking forward to test this.

apichai

http://voxcommando.com/mediawiki/index.php?title=Control_XBMC

follow the instructions in the wiki, let me know if there is anything unclear.
leave your other install of Vox Alone and unzip the attached to a new directory and run it form there.

Let's see what happens!
« Last Edit: November 22, 2014, 02:03:30 PM by jitterjames »

apichai

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
    • View Profile
Re: Possible to use vox with http api? XBMC
« Reply #4 on: June 30, 2010, 11:05:55 PM »


Thank you very much  :D

i'll try it now.

apichai

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Possible to use vox with http api? XBMC
« Reply #5 on: July 08, 2010, 07:33:06 PM »
Hey Apichai any luck?  Check the other thread I am about to post under Vox and XBMC...

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Possible to use vox with http api? XBMC
« Reply #6 on: July 08, 2010, 07:36:40 PM »
also I suggest you get the latest version from the downloads page.  If you want username / password capability I posted on the xbmc forum.

http://forum.xbmc.org/showthread.php?t=9280&page=3

Wanilton

  • $upporter
  • Hero Member
  • *****
  • Posts: 559
  • Karma: 6
    • View Profile
    • XBMC Brazil Forum
Re: Possible to use vox with http api? XBMC
« Reply #7 on: October 05, 2010, 02:03:29 PM »
James,

Good news from team XBMC

Just wanted to say that me and Malard have discussed macros and its been decided that xbmc's jsonrpc will support it, so it will be possible to send an array (as per jsonrpc spec) of commands and you'll get an array of results back.

When it will be added is not decided yet but hopefully for eden.
__________________

Eu efetuei download da versao 0.3 do controle remoto XBMC, usando biblioteca  JSON, e considerei muito interessante o aplicativo, como vão seus avanços nesta área para uso com o VOX?
« Last Edit: October 05, 2010, 03:14:19 PM by Wanilton »
www.xbmcbrasil.net
XBMC  Brazilian Community Forum - Admin
Windows 8.1 - XBMC Gotham Custom Plus - Aeon MQ 5
My Room Entertaiment´s
About me

fonzie

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
Re: Possible to use vox with http api? XBMC
« Reply #8 on: October 05, 2010, 04:52:10 PM »
This sounds like good news.  Could you elaborate a little more on what this could mean in terms of controlling XBMC?  Is it just like running multiples searches simultaneously? Some of these terms are above my head and comprehension.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Possible to use vox with http api? XBMC
« Reply #9 on: October 05, 2010, 05:07:45 PM »
It won't change what we can do.  It may make certain actions slightly more efficient.

When VoxCommando needs to tell xbmc to perform multiple actions (example: clear playlist, then load songs by 'x', then goto first song, then start playing it) it will be able to send a single list of commands to XBMC asking it to do all these things.

The way it works now, is that it asks XBMC to do step 1, then waits for confirmation, then asks for step 2 etc.

In any case it will be a while before any of this actually happens, because the XBMC people are still working on the JSON interface and I won't be implementing it until it is more complete, and I have some free time.

What will be much better is if we can run python scripts on xbmc so that the script can do a bunch of work for us, and perform some conditional stuff too, like: if we don't find any artists then do something else and pop up a message, etc.

When I do implement the JSON interface to XBMC, I will probably leave the old HTTP stuff in place so it will continue to work and no one will be forced to reconfigure anything unless they want access to new commands.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Possible to use vox with http api? XBMC
« Reply #10 on: October 05, 2010, 05:16:20 PM »
James,

Good news from team XBMC

Just wanted to say that me and Malard have discussed macros and its been decided that xbmc's jsonrpc will support it, so it will be possible to send an array (as per jsonrpc spec) of commands and you'll get an array of results back.

When it will be added is not decided yet but hopefully for eden.
__________________

Eu efetuei download da versao 0.3 do controle remoto XBMC, usando biblioteca  JSON, e considerei muito interessante o aplicativo, como vão seus avanços nesta área para uso com o VOX?

thanks Wanilton.  Is Eden the next version after Dharma?  That will probably be a long way off!

I have already downloaded xbmc remote 0.3 and will probably use it as a reference.  I will probably also use the dll that it is using (works with C#) which seems like a good start, but is still a bit 'funny'.  Generally, whatever can be done in the xbmc remote 0.3 program can technically be done in VC, but keep in mind that VoxCommando works with other programs as well so I will try to design features that work universally as much as possible, and make sense in the context of voice commands and TTS.  We can discuss each point as it comes up though.

Wanilton

  • $upporter
  • Hero Member
  • *****
  • Posts: 559
  • Karma: 6
    • View Profile
    • XBMC Brazil Forum
Re: Possible to use vox with http api? XBMC
« Reply #11 on: April 02, 2011, 11:29:44 AM »
Hello James,

In the version of XBMC Eden (11), JSON-RPC is partially developed, and uses port 9090, would be interesting to try to create some basic commands using the new API, it is already possible I think.

extra info: TCP use port 9090 (although this can be customized in latest git through advancedsettings.xml). You should also be able to send json rpc requests, receive responses and receive announcements like "Player.PlaybackStopped" or "Application.Quit"

I found that information that is relevant for us to try something with the vox:

For example:

Is there an example somewhere on how to get CurrentlyPlaying info through JSON?

First call "Player.GetActivePlayers" to determine the currently active player (audio, video or picture). If it is audio or video call Audio/VideoPlaylist.GetItems and read the "current" field to get the position of the currently playling item in the playlist. The "items" field contains an array of all items in the playlist and "items[current]" is the currently playing file. You can also tell jsonrpc which fields to return for every item in the playlist and therefore you'll have all the information you need.

Direct interaction

To be able to test some methods of XBMC's JSON RPC API it can be of great help to be able to send a single hand-written JSON RPC request to XBMC to see its effect and the generated response. Depending on the transport protocol used there are different possibilities to do that:
 
TCP

With a telnet connection (using PuTTY on Windows or telnet on Linux) to port 9090 of the machine running XBMC it is possible to send and receive raw json data to/from XBMC.
 
HTTP

A simple way of manually sending HTTP requests containing a JSON RPC request to XBMC is using the Simple REST Client extension for Google's Chrome/Chromium browser, in this link:
http://chrome.google.com/extensions/detail/fhjcajmcbmldlhcimfajhfbgofnpcjmb , It allows defining an URL and the HTTP request type (POST is what we need). The actual JSON RPC request can be defined in the Data field and then sent to XBMC.

mapped methods in this link:
http://pastebin.com/m4f937676

More info here in Wiki:
http://wiki.xbmc.org/index.php?title=JSON_RPC
« Last Edit: April 02, 2011, 11:37:48 AM by Wanilton »
www.xbmcbrasil.net
XBMC  Brazilian Community Forum - Admin
Windows 8.1 - XBMC Gotham Custom Plus - Aeon MQ 5
My Room Entertaiment´s
About me

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Possible to use vox with http api? XBMC
« Reply #12 on: April 02, 2011, 03:03:09 PM »
I would like to try this but I can't figure it out.  The information in the wiki is terrible.  I don't understand it at all.  If you can find an example of how to use the goodle rest plugin please let me know.

Meanwhile, I think this wonderful new JSON interface is still less powerful than what we have, and I would not be surprised if it were slower too.  What is my motivation here?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Possible to use vox with http api? XBMC
« Reply #13 on: April 02, 2011, 03:34:02 PM »
OK, I figured out how to use the rest plugin in GMail.  See the attached image:

this command successfully adds a song to my now playing playlist.

this is on xmbc 10.1

URL: http://127.0.0.1:8080/jsonrpc
Method: POST
Headers:
Data: {"jsonrpc": "2.0", "method": "AudioPlaylist.Add", "params": { "file": "D:/mp3 from Todd/Amos Lee/Amos Lee/02 Seen It All Before 1.mp3"}, "id": 1}

Wanilton

  • $upporter
  • Hero Member
  • *****
  • Posts: 559
  • Karma: 6
    • View Profile
    • XBMC Brazil Forum
Re: Possible to use vox with http api? XBMC
« Reply #14 on: April 02, 2011, 03:59:57 PM »
Great,  i command Play and Pause, and work fine, hehe.

In XBMC version 11, only work when I set port for 9090, in port 8080 i get error.

Cool...
For play

URL: http://127.0.0.1:9090/jsonrpc
Method: POST
Headers:
Data: {"jsonrpc": "2.0", "method": "AudioPlayer.Play"}

For stop player

URL: http://127.0.0.1:9090/jsonrpc
Method: POST
Headers:
Data: {"jsonrpc": "2.0", "method": "AudioPlayer.Stop"}

One info more: in XBMC setting, the port continue 8080...and work in port 9090 via browser ok;;
« Last Edit: April 02, 2011, 04:19:44 PM by Wanilton »
www.xbmcbrasil.net
XBMC  Brazilian Community Forum - Admin
Windows 8.1 - XBMC Gotham Custom Plus - Aeon MQ 5
My Room Entertaiment´s
About me