Monday, March 31, 2008

Firefox within MythTV

I recently setup a MythTV box with dual tuners. For those that aren't familiar, MythTV is essentially TiVo on steroids! I'm running Ubuntu 7.10 (Gutsy) as my operating system with MythTV v 0.21.20070820-1 as my personal video recorder (PVR). For keyboard and mouse I'm using a BTC 9019URF. I'm also using a Logitech Harmony 670 universal remote to control both my TV and MythTV box -- and it works flawlessly after configuring, testing, and tweaking.

Yesterday I decided I wanted to switch from Mythbrowser as my MythTV web browser to Firefox. Looking around on the web I saw that one simply needs to replace /usr/bin/mythbrowser with /usr/bin/firefox in within Web Settings -- it didn't work.

Here's the problem and what I did to fix it. First, when I made the change and tried launching the browser, nothing happened. The next logical step was to look at the logs (/var/log/mythtv/ mythfrontend.log). I ssh'd in to my MythTV box from another system and saw the following error:

Usage: /usr/lib/firefox/firefox-bin [ options ... ] [URL]
Ok - so some options are being passed to firefox which it can't handle. I went back into the Web Settings in MythTV and changed the browser back to /usr/bin/mythbrowser. I launched the browser and then ssh'd in to my MythTV box from another system and looked for relevant processes:
ps -ef | grep mythbrowser
What I saw, which shed light on the issue, was the following:
sh -c /usr/bin/mythbrowser -x 0 -y 0 -w 800 -h 600 -z 20 http://www.google.com/
See those screen commands, "-x 0 -y 0 -w 800 -h 600 -z 20"? Firefox doesn't like those. The quick solution was to create a simple script that acts as a wrapper to filter out those options. Simply do the following to create the wrapper (I was using tcsh when I did the following...use whatever you want; vi, pico, vim, emacs, whatever...and set the permissions correctly afterwards. This also assumes your firefox is located in /usr/bin -- of course, change this as necessary to match your system):
sudo echo "#\!/bin/sh \
/usr/bin/firefox --fullscreen $11 \
exit 0" \
> /usr/bin/firefox-wrapper
sudo chmod 755 /usr/bin/firefox-wrapper
Then, back on the MythTV frontend, go to Web Settings and change the browser to /usr/bin/firefox-wrapper.

I also installed the following addons and themes for Firefox:
I may experiment with using Smart Bookmarks Bar and NoScript.

I've now replaced Mytbrowser with Firefox on my MythTV box and am loving it!