[ANN] rubytorrent 0.1 (bittorrent for ruby)

W

William Morgan

Hello all,

I'm happy to release RubyTorrent 0.1. RubyTorrent is a pure-Ruby
BitTorrent peer library. Changes in version 0.1 include many bugfixes
(Windows platforms now fully functional) and enhancements (snubbing
support, API improvements, http_proxy). You can get it at:

http://www.masanjin.net/~wmorgan/rubytorrent/rubytorrent-0.1.tar.gz
(RubyForge project coming soon.)

RubyTorrent is around 1500 lines. I've included a simple command-line
text peer program, rtpeer.rb, for you to play around with. The API is
also slowly changing into something useful. From the "docs":

Synopsis
--------

## world's smallest bittorrent client
require 'rubytorrent'
bt = RubyTorrent::BitTorrent.new(ARGV.shift)
thread = Thread.new do
while true
puts bt.percent_completed
sleep 15
end
end
bt.on_complete { thread.kill }
thread.join

Comments, bug reports and patches always welcome. Have fun.
 
P

Paul Duncan

--baEQ7FqpWzRJJ8Oj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* William Morgan ([email protected]) said:
Hello all,
=20
I'm happy to release RubyTorrent 0.1. RubyTorrent is a pure-Ruby
BitTorrent peer library. Changes in version 0.1 include many bugfixes
(Windows platforms now fully functional) and enhancements (snubbing
support, API improvements, http_proxy). You can get it at:
=20
http://www.masanjin.net/~wmorgan/rubytorrent/rubytorrent-0.1.tar.gz
(RubyForge project coming soon.)
=20
RubyTorrent is around 1500 lines. I've included a simple command-line
text peer program, rtpeer.rb, for you to play around with. The API is
also slowly changing into something useful. From the "docs":

Hi William,

It looks like you can add support for remote torrents by changing two
lines. Here's a diff (I'm sending it to the list for discussion):

--
diff -ur rubytorrent-0.1/rubytorrent/metainfo.rb rubytorrent-0.1-openuri/ru=
bytorrent/metainfo.rb
--- rubytorrent-0.1/rubytorrent/metainfo.rb 2005-01-03 23:47:48.000000000=
-0500
+++ rubytorrent-0.1-openuri/rubytorrent/metainfo.rb 2005-01-04 16:01:08.000=
000000 -0500
@@ -1,5 +1,6 @@
require 'rubytorrent/typedstruct'
require 'uri'
+require 'open-uri'
require 'digest/sha1'
=20
## MetaInfo file is the parsed form of the .torrent file that people
@@ -164,7 +165,7 @@
end
=20
def self.from_filename(fn)
- File.open(fn, "rb") { |f| from_bstream(BStream.new(f)) }
+ open(fn, "rb") { |f| from_bstream(BStream.new(f)) }
end
=20
def self.from_stream(fn)
--

With this change, RubyTorrent can then handle URIs to torrent files transpa=
rently, like so:

bt =3D RubyTorrent::BitTorrent.new('http://www.legaltorrents.com/bit/wired-=
creative-commons-cd.torrent')

Hope this helps...
Synopsis
--------
=20
## world's smallest bittorrent client
require 'rubytorrent'
bt =3D RubyTorrent::BitTorrent.new(ARGV.shift)
thread =3D Thread.new do
while true
puts bt.percent_completed
sleep 15
end
end
bt.on_complete { thread.kill }
thread.join
=20
Comments, bug reports and patches always welcome. Have fun.

--=20
Paul Duncan <[email protected]> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

--baEQ7FqpWzRJJ8Oj
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFB2wl5zdlT34LClWIRAkOTAKCE5qQ0na1aIMj4qJ/yjcQLbsy0LQCfdImj
U79cC/9Z28M4vNyzlNBj7Iw=
=J/rc
-----END PGP SIGNATURE-----

--baEQ7FqpWzRJJ8Oj--
 
W

William Morgan

Excerpts from Paul Duncan's mail of 4 Jan 2005 (EST):
It looks like you can add support for remote torrents by changing two
lines. Here's a diff (I'm sending it to the list for discussion):

Thanks. I'll incorporate that in in 0.2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top