↓ Twitter is updated more often, so read it! ↓

HOWTO: Install Gears on 64-bit Linux

I recently noticed that WordPress added support for Gears, as have a few other sites, including ZohoOffice and MySpace.

Gears is essentially offline storage for rich Internet application data. GoogleOS has a list of Gears-enabled sites/applications. Read more on Gears at Wikipedia.

Much to my dismay, the only officially-available Firefox extension supports only 32-bit operating systems. I’m a 64-bit Linux user. Specifically, I use Ubuntu 8.10 Intrepid with my ASUS M3A32-MVP motherboard and 8 GB of DDR2 RAM (4GB of Geil and 4 GB of OCZ).

Fortunately, Gears is an open source project and one intrepid developer made a Gears Firefox extension package which supports 64-bit Linux.

I downloaded and installed the package by dragging and dropping it onto the Firefox Addons dialog, then restarting Firefox when prompted. I archived the Gears extension package on my own site in the event the package is suddenly no longer available. Be sure to check for new versions though, since this package may be out of date if you’re reading this post more than a few days after publication (though unlikely).

Huzzah for open source.

QTL reader in Python

I had a really nasty headache all day today—that kind of headache which affects speech, willpower, and mental processes. I also got really annoyed with Yahoo! Movies because its HD trailers are delivered in some kind of Quicktime playlist file instead of just serving up the movie. In the past, I’ve opened the .qtl file, copied and pasted the obvious URL, and fed it to wget.

Well, I got tired of this. So, I decided to write a script to handle this for me. I first tried to do it using Python’s XML processing features, but the qtl file isn’t a valid XML document. I then tried doing it with RegExps, before realizing that I basically suck with Regexps because I never use them.

Frustrated, I went a watched Casablanca, Aeon Flux, and The Girl Next Door, and had one of those brute force moments.

So, here’s the script. If someone can add a GUI to it or do something cool so it doesn’t have to be run at a command line, that’d be great.

#!/usr/bin/python
import sys,re,os
#lifted from somewhere
def htc(m):
    return chr(int(m.group(1),16))
def urldecode(url):
    rex=re.compile('%([0-9a-hA-H][0-9a-hA-H])',re.M)
    return rex.sub(htc,url)
#get our file
contents = open(sys.argv[1],'r').read()
#here's our markers
startmarker = "src=\""
endmarker = "\" autoplay"
#where are the markers?
srcpos = contents.find(startmarker)
endpos = contents.find(endmarker)
#calculate the real start position
startpos = srcpos + len(startmarker)
#SLICE AND DICE
src = contents[startpos:endpos]
#now we have the URL, but we need a pretty file name
#worked before, do it again
startmarker = "&so="
endmarker = "&tcode"
sopos = src.find(startmarker)
endpos = src.find(endmarker)
startpos = sopos + len(startmarker)
so = src[startpos:endpos]
filepath = urldecode(urldecode(so)) #Yahoo! is silly
filesplit = filepath.split('/')
filename = filesplit[len(filesplit)-1]
print "Getting the file from %s " % src
print "Filename is %s" % filename
thecommand = "/usr/bin/wget -O \"%s.mov\" \"%s\"" % (filename, src)
os.system(thecommand)

It’s probably needlessly long and complex, so shortenings are welcome in the comments.