Category Archives: Peapod

Resolutions

Or should that be vague plans?

  • Attend FOSDEM. I’ve been incredibly lazy the last few years and haven’t attended.
  • Try to prevent the PET Centre from eating my life. This is probably more of a vain hope than a resolution.
  • Buy a flat or learn to drive. Because unless I make it an either/or I will do neither.
  • Attend the spring UKUUG meeting. Understanding kerberos is probably a worthwhile endeavour even if I never use it.
  • Skate more. Assuming we actually get a summer this year it shouldn’t be to hard to top the dismal amount of skating I did last year.
  • Attend at least one observing night of the Cardiff Astronomical Society to remember what the night sky is supposed to look like.
  • Migrate Peapod to a sensible modern XML library to fix some of its more annoying bugs
  • Make an effort to visit friends. Which is just code for be less of a social hermit.

Peapod 0.7

A long weekend is always a good time for a new release. So without further ado I give you Peapod 0.7

Notable bug-fixes include improved syncing with ipods and some clean-up of the verbose output so that it makes more sense.

For those of you who don’t know: peapod is a command-line podcast downloader written in python.

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.