What is µCallback?
µCallback makes it possible to call a script or application when a BitTorrent download finishes.
How to use
[sudo] gem install ucallback
An example - The synchronous version
This example listen for µTorrent downloads. When a download finishes, the block is being called with the name of the downloaded item.
So if you downloaded House.S07E11.HDTV.XviD-LOL.avi the
item variable would be set to just that value.
#!/usr/bin/env ruby require 'rubygems' require 'ucallback' Ucallback.listen('uTorrent') do |item| # Do something with the information end
A background example - The asynchronous version
The previous example runs as an synchronous script, but what if you what to run it in the background?
The daemonize gem fixes this for us. It daemonizes the current thread so we can run it in the background.
Don't forget to install
[sudo] gem install daemons
#!/usr/bin/env ruby require 'rubygems' require 'ucallback' require 'daemons' Daemons.daemonize Ucallback.listen('Transmission') do |item| # Do something with the information end
Save the code above to a file, run
chmod +x the_file_you_just_created on it and you should be able to start it using
How to help
- Start by copying the project or make your own branch.
- Navigate to the root path of the project and run
- Start by running all tests using rspec,
- Implement your own code, write some tests, commit and do a pull request.
µCallback is tested on OS X 10.6.6 using Ruby 1.8.7. With µTorrent beta 1.1.
µCallback only works with µTorrent versions that supports Growl messages.