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

* William Morgan (wmorgan-ruby-talk / masanjin.net) wrote:
> 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 <pabs / pablotron.org>        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--

* William Morgan (wmorgan-ruby-talk / masanjin.net) wrote:
> 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 <pabs / pablotron.org>        pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/               OpenPGP Key ID: 0x82C29562
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

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