Controlling Boxee ?

Posted on
Sun Oct 10, 2010 3:45 am
FaTMax offline
Posts: 134
Joined: Feb 01, 2007
Location: Haugesund, Norway

Controlling Boxee ?

EDIT: I see I posted this in the wrong section, maybe someone can move it to the Indigo Touch forums ?

First of all, thank you so much for the enhanced way of making control pages in Indigo 4! I finally figured out how to make everything work beatiful both on iPad and iPhone this weekend and it has just enhanced the experience with Indigo (again!) to a whole other level!

We use controlpages to control lights, devices, scenes, IR equipment, EyeTV, iTunes and so on. I´ve built a nice grapic UI (the first one is nice, but will be modified slightly) that both me and the misses can play around in with ease. Applescript made this a blast to make. However, I would like to control Boxee with my shiny new control pages. The only thing I have managed to do is make a button for launching and quitting Boxee with Applescript. Seeing as Boxee is a ported app to OS X, its Applescript capabilities is very limited. There is a way to control Boxee via URLs.

http://developer.boxee.tv/Remote_Control_Interface

I´m not sure how to implement this in my control pages, is it as easy suggested ? When running those URLs from the same machine that both Indigo and Boxee reside on, do I have to specify an IP in the URLs ?

Has anyone done something similar ?

Some of my controlpages:
Image
Image
Image

Posted on
Sun Oct 10, 2010 4:27 am
berkinet offline
User avatar
Posts: 3297
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Controlling Boxee ?

FaTMax wrote:
?.. There is a way to control Boxee via URLs.

http://developer.boxee.tv/Remote_Control_Interface

I´m not sure how to implement this in my control pages, is it as easy suggested ? When running those URLs from the same machine that both Indigo and Boxee reside on, do I have to specify an IP in the URLs ?...

It should be pretty easy. I'd suggest using "curl" to manage the communications - it is already installed on your Mac. Just call it with do shell script in your AppleScript. For example:
Set foo to do shell script "date"

For the host address portion of your URL, you can use localhost or 127.0.0.1 - for example:
Http://127.0.0.1/YourStuffGoesHere

I can send you an example if you'd like.

Posted on
Sun Oct 10, 2010 4:30 am
FaTMax offline
Posts: 134
Joined: Feb 01, 2007
Location: Haugesund, Norway

Re: Controlling Boxee ?

My knowhow is limited to some Applescript, so an example would be just great! Never done anything with shell scripts.

Practice makes perfect, so I´d love to learn more ;)

Posted on
Sun Oct 10, 2010 5:19 am
berkinet offline
User avatar
Posts: 3297
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Controlling Boxee ?

No, problem... Well, one problem, I am on my iPad at the moment. I'll send you an example in a few hours when I am back on the Mac. In the meantime, try a search of the forums for keyword curl. I am pretty sure there is something close to what you are looking for. This one may be helpful...
viewtopic.php?f=5&t=4963&p=36403&hilit=Curl#p36403

Posted on
Sun Oct 10, 2010 3:19 pm
FaTMax offline
Posts: 134
Joined: Feb 01, 2007
Location: Haugesund, Norway

Re: Controlling Boxee ?

I have been snooping around, and thought i did a breakthrough when i could initiate Pause/Play with this little applescript. I "made it up myself", meaning I have no idea if it is formatted or even fully written the way it should.

This one actually works:
Code: Select all

tell current application
    do shell script "curl -o /dev/null http://192.168.10.105:8800/xbmcCmds/xbmcHttp?command=Pause"
end tell


This one (and the other SendKey and Action commands) does not work, for some weird reason:
Code: Select all
tell current application
    do shell script "curl -o /dev/null http://192.168.10.105:8800/xbmcCmds/xbmcHttp?command=SendKey(270)"
end tell


This last one is supposed to move up in the Boxee menusystem.

I´m a little stuck atm. Anyone care to enlighten me ? :)

Posted on
Sun Oct 10, 2010 11:02 pm
berkinet offline
User avatar
Posts: 3297
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Controlling Boxee ?

The tell current application and end tell should not be necessary. Otherwise it looks like you've got the idea. The command that didn't work looked ok to me, maybe it is a bug in boxee. To do a simple test of your command, just enter it in the URL field of the Safari window and press return.

BTW, if you want to capture output from the boxee command, you can do:
Code: Select all
set foo to do shell script "curl http://localhost:8800/xbmcCmds/xbmcHttp?command=SomeCommand"


If the output you want is long, or complexly formatted, post it here and I can show you ways to filter it in the shell script.

Posted on
Mon Oct 11, 2010 2:22 am
FaTMax offline
Posts: 134
Joined: Feb 01, 2007
Location: Haugesund, Norway

Re: Controlling Boxee ?

I think you are on to something. It must be a bug in Boxee. In Safari i get a OK output, which it also does when I do the pausecommand. There are hundreds of commands, so I will just have to try them one by one. Sadly, I've left for work now for 4 days, but I'll post an update when I get back in the weekend.

Thanks for pointing me in the right direction!!

Posted on
Mon Oct 11, 2010 9:08 am
jay (support) offline
Site Admin
User avatar
Posts: 18231
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Controlling Boxee ?

Parenthesis characters aren't valid in a URL, so you have to URL encode them:

( = %28
) = %29

So, the command to do an up arrow would be:
Code: Select all
curl -o /dev/null http://localhost:8800/xbmcCmds/xbmcHttp?command=SendKey%28270%29


I'm not that familiar with the curl options so there may be some way to have it do the URL encoding...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Oct 11, 2010 9:13 am
FaTMax offline
Posts: 134
Joined: Feb 01, 2007
Location: Haugesund, Norway

Re: Controlling Boxee ?

Hm, that could explain it ;)

Posted on
Mon Oct 11, 2010 11:55 am
berkinet offline
User avatar
Posts: 3297
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Controlling Boxee ?

I am not sure about the use of parentheses in a GET method Query-String (text after after the "?"). I found this page with details on the xbmc web interface (this should be pretty much the same as boxee). They repeatedly call out the parentheses. Also, the fact you received an "Ok" response to your Safari test would indicate the command string was valid

Posted on
Mon Oct 11, 2010 2:31 pm
jay (support) offline
Site Admin
User avatar
Posts: 18231
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Controlling Boxee ?

I tried it with the parens encoded and it worked... ;)

However, you definitely should go with the supported API IMHO... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Oct 14, 2010 9:09 am
FaTMax offline
Posts: 134
Joined: Feb 01, 2007
Location: Haugesund, Norway

Re: Controlling Boxee ?

It DOES work, only to well. Mine continues to press the button even after I´ve stopped pressing it. Meaning: If I press Up, Boxee continues to go UP until i Quit Boxee. Seems weird. Did you get that behaviour ?

EDIT:

i did a stop script command, seemed to do the trick. Would that be right ? Just wanna make sure, so I dont mess up anything here... ;)

Oh, and I also do: tell application "System Events"

Thats right too ?

EDIT2:

Whats this API you are talking about ?

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests