Add shell/+rtorrent

This commit is contained in:
Henrik Lissner 2017-09-02 19:10:48 +02:00
parent 2bca457940
commit 9f798429bc
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 114 additions and 0 deletions

View file

@ -0,0 +1,92 @@
# Instance layout (base paths)
method.insert = cfg.basedir, private|const|string, (cat,"/home/hlissner/rtorrent/")
method.insert = cfg.watch, private|const|string, (cat,(cfg.basedir),"watch/")
method.insert = cfg.logs, private|const|string, (cat,(cfg.basedir),"log/")
method.insert = cfg.logfile, private|const|string, (cat,(cfg.logs),"rtorrent-",(system.time),".log")
# Create instance directories
execute.throw = bash, -c, (cat,\
"builtin cd \"", (cfg.basedir), "\" ",\
"&& mkdir -p .session download log watch/{load,start}")
# Listening port for incoming peer traffic (fixed; you can also randomize it)
network.port_range.set = 50000-50000
network.port_random.set = no
# Tracker-less torrent and UDP tracker support
# (conservative settings for 'private' trackers, change for 'public')
# dht.mode.set = disable
protocol.pex.set = yes
trackers.use_udp.set = yes
# Peer settings
throttle.max_uploads.set = 50
throttle.max_uploads.global.set = 100
# Don't hog upload by default. I won't seed at all if I'm not on my home
# network. It's not my bandwidth to hog!
throttle.global_up.max_rate.set_kb = 3
throttle.min_peers.normal.set = 10
throttle.max_peers.normal.set = 40
throttle.min_peers.seed.set = 20
throttle.max_peers.seed.set = 60
trackers.numwant.set = 80
protocol.encryption.set = allow_incoming,try_outgoing,enable_retry
# Limits for file handle resources, this is optimized for
# an `ulimit` of 1024 (a common default). You MUST leave
# a ceiling of handles reserved for rTorrent's internal needs!
network.http.max_open.set = 50
network.max_open_files.set = 500
network.max_open_sockets.set = 250
# Memory resource usage (increase if you have a large number of items loaded,
# and/or the available resources to spend)
pieces.memory.max.set = 1800M
network.xmlrpc.size_limit.set = 4M
# Basic operational settings (no need to change these)
session.path.set = (cat, (cfg.basedir), ".session/")
directory.default.set = (cat, (cfg.basedir), "download/")
log.execute = (cat, (cfg.logs), "execute.log")
##log.xmlrpc = (cat, (cfg.logs), "xmlrpc.log")
execute.nothrow = bash, -c, (cat, "echo >",\
(session.path), "rtorrent.pid", " ", (system.pid))
# Other operational settings (check & adapt)
encoding.add = utf8
system.umask.set = 0027
system.cwd.set = (directory.default)
network.http.dns_cache_timeout.set = 25
##network.http.capath.set = "/etc/ssl/certs"
##network.http.ssl_verify_peer.set = 0
##network.http.ssl_verify_host.set = 0
##pieces.hash.on_completion.set = no
##keys.layout.set = qwerty
##view.sort_current = seeding, greater=d.ratio=
schedule2 = monitor_diskspace, 15, 60, ((close_low_diskspace, 1000M))
# Some additional values and commands
method.insert = system.startup_time, value|const, (system.time)
method.insert = d.data_path, simple,\
"if=(d.is_multi_file),\
(cat, (d.directory), /),\
(cat, (d.directory), /, (d.name))"
method.insert = d.session_file, simple, "cat=(session.path), (d.hash), .torrent"
# Watch directories (add more as you like, but use unique schedule names)
schedule2 = watch_start, 10, 10, ((load.start, (cat, (cfg.watch), "start/*.torrent")))
schedule2 = watch_load, 11, 10, ((load.normal, (cat, (cfg.watch), "load/*.torrent")))
# Logging:
# Levels = critical error warn notice info debug
# Groups = connection_* dht_* peer_* rpc_* storage_* thread_* tracker_* torrent_*
print = (cat, "Logging to ", (cfg.logfile))
log.open_file = "log", (cfg.logfile)
log.add_output = "info", "log"
##log.add_output = "tracker_debug", "log"
### END of rtorrent.rc ###

View file

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Pause all torrents from outside rtorrent, in case rtorrent is crashing on
# startup.
for i in ~/rtorrent/.session/*.torrent.rtorrent; do
sed -i -re 's/5:statei1e/5:statei0e' $i
done

14
shell/+rtorrent/install Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
case $OSTYPE in
darwin*)
# TODO
;;
linux*)
if [[ -f /etc/arch-release ]]; then
sudo pacman --needed --noconfirm -S rtorrent
pip install pyrocore
fi
esac