citizen428.blog()

Try to learn something about everything

New Ruby Stuff

It’s time for some good Ruby-related news again! After version bumping ncurses-ruby I added two new packages to the tree.

The first one is ruby-mp3info and was submitted via Bugzilla. It’s written in pure Ruby and gives you access to a lot of low level information about mp3 files, like bitrate and samplerate. Besides that it can read and write id3v1 and read id3v2.

But the really cool thing I’ve added today is RubyTorrent. I’ve stumbled across this project a while ago and took the 0.3 release as a motivation to finally add it to the tree. Check it out, it’s really cool stuff.

Here’s an example that I’ve stolen from the project’s website:

1
2
3
4
5
6
7
8
9
10
require 'rubytorrent'
bt = RubyTorrent::BitTorrent.new(ARGV.shift)
thread = Thread.new do
  while true
    puts bt.percent_completed
    sleep 15
  end
end
bt.on_event(self, :complete) { thread.kill }
thread.join

Yeah, that’s a BitTorrent client. Really. Nifty, isn’t it?

Comments