Skip to content

Instantly share code, notes, and snippets.

@rdamen
Created March 28, 2009 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdamen/87052 to your computer and use it in GitHub Desktop.
Save rdamen/87052 to your computer and use it in GitHub Desktop.
my rtorrent config
# .rtorrent.rc - my rtorrent config
# for more info see:
# http://libtorrent.rakshasa.no/rtorrent/rtorrent.1.html
session = ~/.rtorrent
encryption = allow_incoming,try_outgoing,enable_retry
dht = off
dht_port = 16881
port_range = 16800-16900
port_random = no
use_udp_trackers = yes
peer_exchange = yes
download_rate = 800
upload_rate = 25
max_uploads = 1
min_peers = 40
max_peers = 100
min_peers_seed = 1
max_peers_seed = 1
check_hash = yes
directory = ~/incoming/.torrent/incomplete
schedule = queue,0,30,"execute=~/bin/rqueue"
schedule = watch,5,30,"load_start=~/incoming/.torrent/active/*.torrent"
schedule = untie,5,30,"remove_untied="
schedule = space,5,60,"close_low_diskspace=500M"
system.method.set_key = event.download.finished,rm_torrent,"execute=rm,$d.get_tied_to_file="
system.method.set_key = event.download.finished,mv_torrent,"execute=mv,-u,$d.get_base_path=,~/incoming/ ;d.set_directory=~/incoming/"
#!/usr/bin/env ruby
# rqueue - rtorrent queue
module Rqueue
class << self
def go!
@maximum = 4
@pending = expand('~/incoming/.torrents')
@running = expand('~/incoming/.torrents/active')
if torrents(@running).count < @maximum
oldest_file = String.new
oldest_time = Time.new
torrents(@pending).each do |torrent|
if age(torrent) < oldest_time
oldest_file = torrent
oldest_time = age(torrent)
end
end
start(oldest_file) unless oldest_file.empty?
end
end
def expand(path)
File.expand_path(path)
end
def torrents(path)
Dir.glob(expand(path) + "/*.torrent")
end
def age(file)
File.stat(expand(file)).mtime
end
def start(file)
`mv \"#{file}\" #{@running}`
end
end
end
Rqueue.go!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment