13 Feb 2010

Switching between Plex, Hulu, and Boxee on a Mac HTPC

Mac-htpc

So you want a Mac HTPC but you can't decide whether to use Boxee, Hulu, or Plex.

Neither can I -- that's why I use all three.

The biggest annoyance in doing that is switching between them. While I won't call this method the cleanest out there, it gets the job done.

The remote I use is actually the Logitech diNovo Mini keyboard. It retails for $150 but I know I got it a lot cheaper by looking for it in discount places. Since this is a computer I like having a full keyboard. If the Boxee remote had been out at the time I would have considered getting that, but I am not sure I would be able to do the switching I am going to describe below.

For switching I use a combination of Spark (global hotkeys) and the pkill command. I took the script from here, copied below:

#!/bin/sh

for X in `ps acx | grep -i $1 | awk {'print $1'}`; do
kill $X;
done

and put it in /usr/bin with the name pkill. Don't forget to chmod 755 it so it will execute.

NOTE: I wish I didn't have to kill the process and could do it more gracefully, but this is the best I have for now.

From there I created 3 scripts to do the killing and starting. Here is my script called SwitchToBoxee which I put in my user bill's .scripts directory (that I created):
pkill Plex
pkill Hulu
sleep 5
open "/Applications/Boxee.app"

All you need to do is change the killing and the starting to create SwitchToPlex and SwitchToBoxee.

Finally I created the Applescripts in Spark to call these scripts. Here's mine for Boxee, I use <COMMAND>-7 to launch:

do shell script "/Users/bill/.scripts/SwitchToBoxee"

Repeat for Hulu and Plex.

Don't forget to stop and restart the Spark daemon. I stared at the screen for about 5 minutes before realizing that's why my hot keys weren't working.

I hope this is helpful for someone else, I know this is much nicer than switching between apps manually. You can also create another script to launch your browser if you want.