I was looking around for a pure ruby bit torrent lib. I found rubytorrent but the ruby forge page was not working. I would like to use event machine to create a script to download torrent files in ruby. I have started by parsing torrent files.
After reading wiki pages, c and python code I wrote a class to decode the Bencoded files. The protocol website was down. The bencode breaks down to this. l means array, d means hash, #s means bits, and i means integer. They all end with an e. As the wiki example shows list can be nested and so can hashes..
TorrentFile::Bencode.decode("l4:spam4:eggsl4:spam4:eggsei67ee")
I am not really happy with the decode code. I think it can be done much better
Anyway, I have the file object setup.
tf = TorrentFile.new(@test_file)
tf.name
tf.is_single_file?
Step one down...
Its in my svn repo
http://svn.stephenbeckeriv.com/code/bittorrent/torrent_file.rb