VoxCommando

Help and Support (Using VoxCommando) => XBMC (Old board see 'KODI' above) => Topic started by: apichai on June 30, 2010, 12:12:55 AM

Title: Possible to use vox with http api? XBMC
Post by: apichai 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 (http://forum.xbmc.org/showthread.php?t=68263)

API commands QueryMusicDatabase, QueryVideoDatabase

Apichai
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames 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.
Title: Re: Possible to use vox with http api? XBMC
Post by: apichai on June 30, 2010, 08:52:22 AM
Great,

Looking forward to test this.

apichai
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames on June 30, 2010, 05:27:40 PM
Great,

Looking forward to test this.

apichai

http://voxcommando.com/mediawiki/index.php?title=Control_XBMC (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!
Title: Re: Possible to use vox with http api? XBMC
Post by: apichai on June 30, 2010, 11:05:55 PM


Thank you very much  :D

i'll try it now.

apichai
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames 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...
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames 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
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton 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?
Title: Re: Possible to use vox with http api? XBMC
Post by: fonzie 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.
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames 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.
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames 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.
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton 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
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames 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?
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames 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}
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton 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;;
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames on April 02, 2011, 04:08:27 PM
that's weird because I thought 9090 was for "raw tcp" but 8080 was for http access.
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames on April 02, 2011, 04:22:39 PM
I just upgraded to XBMC version 11 and it still only works for me if I use port 8080.

If I try to use port 9090 it just says "Processing..."  and stays like that forever

Is it possible you changed your web server port to 9090 for some reason?
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames on April 02, 2011, 04:26:40 PM
meanwhile, it accepts the command:

 {"jsonrpc": "2.0", "method": "AudioPlayer.Play"}

but it doesn't actually do anything.  It does not play.  Wanilton, does it actually play for you?
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton on April 02, 2011, 04:28:46 PM
Yes, worked fine play and stop command for me, using method posted for me before,
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"}

Press send, stop the audio player ok.

Alert:
Remember I am using XBMC 11, the last release 04/02/2011
http://mirrors.xbmc.org/nightlies/win32/XBMCSetup-20110402-0c66478-master.exe

Version 11 is not compatible with aeon.skinmq.2 in version 2.7.1, version 11 only work in new version 2.8.0, in mode lite (new mode).
Skin aeonmq.2 version 2.8.0 no released for public yet, under development, expected to release in 3 weeks..
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames on April 02, 2011, 05:44:42 PM
I am using the same version of XBMC and it only works on port 8080.

WTF?
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton on April 02, 2011, 09:06:00 PM
In port 8080, this error message for me
Status:200 OK

Headers:

Data:
{"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}{e":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
Copyright © 2010 Jeremy Selier - Source code licensed under the Apache License - icon by Jason Rayner

I observe when I set port 9090, worked,.
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton on April 02, 2011, 09:10:39 PM
James,

I reboot the computer, and now work too in port 8080, great...i don´t change anything...no more error send command in port 8080..

For PLAY music in Audioplaylist I use this
{"jsonrpc":"2.0","method":"Audioplaylist.Play"}

And work ok

Play Next Music, worked fine too
{ "jsonrpc": "2.0", "method": "AudioPlayer.SkipNext"}

Other commando ok, it´s work fine
{"jsonrpc": "2.0", "method": "XBMC.Quit"}

When I send This Command
{ "jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "params": { "fields": ["album", "lyrics", "duration", "rating"], "end": 002 }, "id": 1 }

Return this Data:
{"id":1,"jsonrpc":"2.0","result":{"albums":[{"album":"One Cell In the Sea","albumid":1,"duration":0,"label":"One Cell In the Sea","rating":48,"thumbnail":"special://masterprofile/Thumbnails/Music/9/9293979f.tbn"},{"album":"Black Ice","albumid":2,"duration":0,"label":"Black Ice","rating":48,"thumbnail":"special://masterprofile/Thumbnails/Music/b/b325aa78.tbn"}],"end":2,"start":0,"total":205}}

Wanilton
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames on April 03, 2011, 01:14:45 PM
as far as I can tell the JSON in this version:
http://mirrors.xbmc.org/nightlies/win32/XBMCSetup-20110402-0c66478-master.exe

is broken
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton on April 03, 2011, 02:49:30 PM
James, for me it´s ok, in port 8080...stop command and others.....I Update my XBMC every day, with new releases, i am using  04/03/2011 version XBMC.

What´s command is broken for you??
Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames on April 03, 2011, 03:09:48 PM
all of them return results in the wrong format.

but in particular, commands with optional field parameters like this:

{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "start": 0, "end": 100, "sortorder":"ascending", "fields": ["genre", "director", "trailer", "tagline", "plot", "plotoutline", "title", "originaltitle", "lastplayed", "showtitle", "firstaired", "duration", "season", "episode", "runtime", "year", "playcount", "rating"] }, "id": 1}

it doesn't matter what you put in the fields, it always return all fields.

but it doesn't matter since the JSON commands are of absolutely no value to us.  They don't do anything that we can't already do (much less actually), so I am waiting to see if they add any new features.  I am told that there will be some changes *soon*. I do not have very high hopes though.  I am just hoping that the http api will not be removed because I don't think XBMC JSON will ever be able to offer us what we need.  The whole situation is very sad.
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton on April 05, 2011, 09:00:17 AM
James, Look this post, In this release launched today has important changes in Json Implementation in XBMC Eden.

http://mirrors.xbmc.org/nightlies/win32/XBMCSetup-20110405-774b886-master.exe

Read this post for info about changes:

http://forum.xbmc.org/showthread.php?p=767487


Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames on April 05, 2011, 10:22:26 AM
:'(

I guess they aren't adding any useful commands.  If they actually try to remove the http api from Eden, there will surely be a mass uprising of the people!
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton on April 05, 2011, 12:36:08 PM
In this version of Eden I do not think anything will change in http API, perhaps in next year's version will do remove, but a lot can happen until then.
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton on April 24, 2011, 09:11:57 PM
all of them return results in the wrong format.

but in particular, commands with optional field parameters like this:

{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "start": 0, "end": 100, "sortorder":"ascending", "fields": ["genre", "director", "trailer", "tagline", "plot", "plotoutline", "title", "originaltitle", "lastplayed", "showtitle", "firstaired", "duration", "season", "episode", "runtime", "year", "playcount", "rating"] }, "id": 1}

it doesn't matter what you put in the fields, it always return all fields.

but it doesn't matter since the JSON commands are of absolutely no value to us.  They don't do anything that we can't already do (much less actually), so I am waiting to see if they add any new features.  I am told that there will be some changes *soon*. I do not have very high hopes though.  I am just hoping that the http api will not be removed because I don't think XBMC JSON will ever be able to offer us what we need.  The whole situation is very sad.

Hello James, today I try again, and work ok, I Used the last version nightly, release today 04/24:
http://mirrors.xbmc.org/nightlies/win32/XBMCSetup-20110423-36be7fb-master.exe

http://127.0.0.1:8080/jsonrpc

I use this commands
{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"fields": ["title","year"],"sort":{"method":"label","order":"ascending"}},"id": 1}

Return this Data:
{"id":1,"jsonrpc":"2.0","result":{"limits":{"end":336,"start":0,"total":336},"movies":[{"label":"007 - A Serviço Secreto de Sua Majestade","movieid":383,"title":"007 - A Serviço Secreto de Sua Majestade","year":1969},{"label":"007 - Contra o Foguete da Morte","movieid":486,"title":"007 - Contra o Foguete da Morte","year":1979},{"label":"007 - Contra o Homem com a Pistola de Ouro","movieid":589,"title":"007 - Contra o Homem com a Pistola de Ouro","year":1974},{"label":"007 - Marcado Para a Morte","movieid":585,"title":"007 - Marcado Para a Morte","year":1987}

Conclusion: The filter work now, return only fields I request.

Read this post, with news changes in Json
http://forum.xbmc.org/showthread.php?t=98551 in special:
Added a new namespace Input containing the following methods to navigate in the XBMC GUI:
Up
Down
Left
Right
Select
Back
Home

Wanilton
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton on March 27, 2012, 03:03:40 PM
Hello James,

Montelesse Add support for WebSockets in XBMC, Websoctkets are accessible using the port of the TCP server (by default 9090) and using version 8 (draft) or 13 (final) of the websocket specification. So the URL to access the websocket would be e.g.
 
ws://localhost:9090/jsonrpc
 For now websockets are only available for JSON-RPC and support the same features as the TCP Server (i.e. notifications but no file download).

And here comes the first (rather big) update for JSON-RPC API v5:

 •added System.EjectOpticalDrive and a new permission ControlSystem
 •added GUI namespace with the methods ShowNotification, SetFullscreen and GetProperties (current properties are "currentwindow", "currentcontrol", "fullscreen" and "skin")
 •added AudioLibrary.GetRecentlyPlayedAlbums and AudioLibrary.GetRecentlyPlayedSongs
 •added properties "size", "lastmodified" and "mimetype" to Files.GetDirectory
 •added properties "season" and "watchedepisodes" to VideoLibrary.GetTvShows and "watchedepisodes" to VideoLibrary.GetSeasons
 •added notification Application.OnVolumeChanged
 •extended Application.SetVolume to support "increment" and "decrement"
 •added optional "play" parameter to Player.PlayPause
 •added optional "enable" parameter to Player.SetSubtitle
 •added optional "directory" parameter to (Audio|Video)Library.Scan
 •added optional "options" parameter to Player.Open which can have the properties "shuffled", "repeat" and "resume"
 •improved properties returned by Player.GetItem for non-library media being played
 •added sort methods "country", "dateadded", "listeners" and "bitrate


I am uploading a latest version xbmc eden installer, this websockets help us with vox ??

Thanks.


Title: Re: Possible to use vox with http api? XBMC
Post by: jitterjames on March 27, 2012, 03:15:05 PM
Hello James,

Montelesse Add support for WebSockets in XBMC, Websoctkets are accessible using the port of the TCP server (by default 9090) and using version 8 (draft) or 13 (final) of the websocket specification. So the URL to access the websocket would be e.g.
 
ws://localhost:9090/jsonrpc
...
...
I am uploading a latest version xbmc eden installer, this websockets help us with vox ??

I don't think so, but I'm not really sure.
Title: Re: Possible to use vox with http api? XBMC
Post by: Wanilton on March 27, 2012, 03:32:41 PM
Link for download:

http://dl.dropbox.com/u/25170804/XBMCSetup-frodo-dx.exe

XBMC Eden 11, with fix after oficial release, include add from Montelesse.

I am tested, don´t broke anything in skin aeonmq.3

Thanks

Wanilton