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.
--
William <wmorgan-ruby-talk@masanjin.net>
Awesome project.
Thank you so much. this will be very valuable
···
On Tue, 4 Jan 2005 13:59:56 +0900, William Morgan <wmorgan-ruby-talk@masanjin.net> wrote:
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.
--
William <wmorgan-ruby-talk@masanjin.net>
--
Tobi
http://www.hieraki.org - Open source book authoring
http://blog.leetsoft.com - Technical weblog
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):
···
* William Morgan (wmorgan-ruby-talk@masanjin.net) wrote:
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":
--
diff -ur rubytorrent-0.1/rubytorrent/metainfo.rb rubytorrent-0.1-openuri/rubytorrent/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.000000000 -0500
@@ -1,5 +1,6 @@
require 'rubytorrent/typedstruct'
require 'uri'
+require 'open-uri'
require 'digest/sha1'
## MetaInfo file is the parsed form of the .torrent file that people
@@ -164,7 +165,7 @@
end
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
def self.from_stream(fn)
--
With this change, RubyTorrent can then handle URIs to torrent files transparently, like so:
bt = RubyTorrent::BitTorrent.new('http://www.legaltorrents.com/bit/wired-creative-commons-cd.torrent'\)
Hope this helps...
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.
--
Paul Duncan <pabs@pablotron.org> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562
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.
···
--
William <wmorgan-ruby-talk@masanjin.net>