Debian ate my Webserver

I’ve been meaning to upgrade to apache2 for a while now. So I set about doing it yesterday as it was the only legacy app I had left on the debian testing box I run this blog from. The wordpress installation I use to run peapodpy.org migrated with minimal fuss. The mambo installation I was using for hlynes.com just died. No amount of prodding would convince it to come back.

I’ve been getting more irritated with mambo as time passes anyway so I decided to see if there was an easy way to migrate my blog to wordpress. Lo and behold mambo2wordpress does the job. Now all I have to do is figure out why the RSS feed is setting pubDate to 01 Jan 1970 for everything.

*Update*
Looks like it’s only the imported articles that have wrong pubDates. So hopefully as new entries go on RSS aggregators should be able to sort things out. Probably a formatting thing with the old articles that the RSS creator in WordPress is objecting to.

Making a Minimalist Bittorrent Client

I spent the weekend sorting out bittorrent support in Peapod so that it
wasn't quite such a mess. Previously I had hacked a version of
btdownloadheadless.py so that it would exit when the download
completed. I was then shelling out to this from within Peapod.
Obviously this is a less than ideal situation partly because it meant I had to escape URLs from the shell. So I hacked away at btdownloadheadless.py until I had a simple class I could call to do the bittorrent download. It gives almost no feedback
except a return code upon completion of the download.

from btclient import mytorrent
url = "http://www.evilgeniuschronicles.org/audio/egc-2005-10-10.mp3.torrent"
save_dir  = /tmp
torrent = mytorrent(url,save_dir)
ret = torrent.run()
sys.exit(ret)

If you wanted to carry on seeding rather than exiting on completion you could do:

torrent = mytorrent(url,save_dir,selfish=0)
torrent.run()

I then added a name == "__main__" section into btclient so that it can be used a simple bittorrent client.
btclient.py http://www.evilgeniuschronicles.org/audio/egc-2005-10-10.mp3.torrent /tmp
or to seed:
btclient.py http://www.evilgeniuschronicles.org/audio/egc-2005-10-10.mp3.torrent /tmp seed

btclient.py  can be downloaded from here or alternatively see our subversion repository where the latest version can always be found.

Hopefully someone will find this useful.

Playing Movies on the iAudio X5

I am enraptured by my new Cowan iAudio X5.
It plays both flac and ogg vorbis and appears to my linux box as a
standard USB storage device. Given this level of openness I’m willing
to forgive it for running some version of embedded windows.

However until today I hadn’t got around to trying to get it to play
back any useful videos. It comes loaded with some short video clips
which are basically adverts for other Cowan products. However by
interrogating these clips with mplayer I was able to glean the
following information.

VIDEO: [XVID] 160×108 24bpp 13.000 fps 189.4 kbps (23.1 kbyte/s)
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)

Now I’m no whizz with mencoder so I had to do some searching around until I found a good intro to using mencoder. With that in hand I was able to put together an encoder command that worked.

mencoder inputfile.avi -o outputfile.avi -ovc lavc -oac lavc -lavcopts acodec=mp3:abitrate=96 -ofps 13 -vf scale=160:108

I added the lower bitrate for the audio as some sources suggest that
this makes playback more stable. Theoretically the X5 will play back
video at 15fps but can get unhappy so sticking at 13 seems sensible.
Now I’m not sure that I’d want to watch Lord of the Rings at 160×108
but character driven drama like House or The West Wing is remarkably
watcheable at this resolution. I doubt I’ll use this feature day to day
but if I was preparing for a long flight I might whack a couple of
seasons of my favourite TV shows onto the X5 to serve as an alternative
to the inevitabley dreadful in-flight movie.

Continue reading Playing Movies on the iAudio X5