rTorrent
rTorrent 是一个快速高效的 BitTorrent 客户端,它使用 libTorrent 库并在其基础上开发(不要与 libtorrent-rasterbar 混淆)。它使用 C++ 编写,并通过 ncurses 编程库提供基于终端的用户界面。当与终端复用器(例如 GNU Screen 或 Tmux)和 Secure Shell 结合使用时,它将成为一个便捷的远程 BitTorrent 客户端。
安装
非官方软件包
- rtorrent-gitAUR - Git master 分支 软件包
- rtorrent-psAUR - 带有 rtorrent-ps 补丁集 的发布软件包
- rtorrent-pyro-gitAUR - Git feature-bind 分支 软件包,带有 rtorrent-ps 补丁集
- rtorrent-vi-colorAUR - 带有类似 vi 的快捷键绑定的发布软件包
配置
- 有关此主题的更多信息,请参阅 rTorrent wiki 文章:rTorrent 菜鸟常用任务。
- Vim 可能会误解配置文件的语法,从而导致高亮显示错误。要解决此问题,您可以 附加 模型行
# vim: set filetype=conf
到~/.rtorrent.rc
,或安装 rtorrent-syntax-file。
在运行 rTorrent 之前,将示例配置文件 /usr/share/doc/rtorrent/rtorrent.rc
复制到 ~/.rtorrent.rc
,并查看 相关的 rTorrent wiki 页面,其中包含 现代 基本配置文件。
性能
以下选项的值取决于系统的硬件和 Internet 连接速度。
throttle.min_peers.normal.set = 40 throttle.max_peers.normal.set = 52 throttle.min_peers.seed.set = 10 throttle.max_peers.seed.set = 52 throttle.max_uploads.set = 8 throttle.global_down.max_rate.set = 200 throttle.global_up.max_rate.set = 28
pieces.hash.on_completion.set
选项在 rTorrent 启动时执行哈希检查。它检查已完成文件中的错误。
pieces.hash.on_completion.set = yes
创建和管理文件
directory.default.set
选项将确定 torrent 数据的保存位置(可以是相对路径)
directory.default.set = ~/downloaded
session.path.set
选项允许 rTorrent 保存 torrent 的进度。建议在主目录中创建一个目录(例如 mkdir ~/.rtorrent.session
)。
session.path.set = ~/.rtorrent.session
schedule2
选项使 rTorrent 监视特定目录中的新 torrent 文件。将 torrent 文件保存到此目录将自动开始下载。请记住创建将被监视的目录(例如 mkdir ~/watch
)。此外,使用此选项时要小心,因为 rTorrent 会将 torrent 文件移动到会话文件夹并将其重命名为其哈希值。
schedule2 = watch_directory,5,5,load.start=/home/user/watch/*.torrent schedule2 = untied_directory,5,5,stop_untied= schedule2 = tied_directory,5,5,start_tied=
以下 schedule2
选项旨在在磁盘空间不足时阻止 rTorrent 下载数据。
schedule2 = low_diskspace,5,60,((close_low_diskspace,100M))
端口配置
network.port_range.set
选项设置要用于监听的端口。建议使用高于 49152 的端口(请参阅:端口号列表)。虽然 rTorrent 允许使用端口范围,但建议使用单个端口。
network.port_range.set = 49164-49164
此外,请确保为正确的端口启用端口转发(请参阅:端口转发指南)。
附加设置
protocol.encryption.set
选项启用或禁用加密。启用此选项非常重要,不仅为了您自己,还为了 torrent 群中的对等方。有些用户需要对 ISP 隐藏其带宽使用情况。即使您不需要额外的安全性,启用它也没有坏处。
protocol.encryption.set = allow_incoming,try_outgoing,enable_retry
也可以强制所有连接都使用加密。但是,请注意,此更严格的规则将降低客户端的可用性
protocol.encryption.set = require,require_RC4,allow_incoming,try_outgoing
另请参阅 Wikipedia:BitTorrent 协议加密。
最后的 dht.mode.set
选项启用 DHT 支持。DHT 在公共 tracker 中很常见,它将允许客户端获取更多对等方。
dht.mode.set = auto dht.port.set = 6881 protocol.pex.set= yes
快捷键绑定
rTorrent 完全依赖键盘快捷键进行用户输入。下表提供了快速参考。rTorrent wiki 上提供了完整指南(请参阅:rTorrent 用户指南)。
Ctrl-q
将使 rTorrent 关闭,而无需等待向连接的 tracker 发送停止公告。命令 | 操作 |
---|---|
Ctrl-q | 退出应用程序 |
Ctrl-s | 开始下载。除非已完成,否则首先运行哈希。 |
Ctrl-d | 停止活动下载或删除已停止的下载 |
Ctrl-k | 停止并关闭活动下载的文件。 |
Ctrl-r | 启动 torrent 的哈希检查。如果文件不可用,则开始下载。 |
Ctrl-o | 指定已添加但未启动的 torrent 的下载目录。 |
向左 | 返回上一屏幕 |
向右 | 转到下一屏幕 |
退格键 | 添加并启动指定的 *.torrent |
回车键 | 添加但不启动指定的 *.torrent |
a|s|d | 将全局上传限制提高约 1|5|50 KB/s |
A|S|D | 将全局下载限制提高约 1|5|50 KB/s |
z|x|c | 将全局上传限制降低约 1|5|50 KB/s |
Z|X|C | 将全局下载限制降低约 1|5|50 KB/s |
冗余映射
Ctrl-s
通常用于终端控制以停止屏幕输出,而 Ctrl-q
用于启动屏幕输出。这些映射可能会干扰 rTorrent。检查这些终端选项是否绑定到映射
$ stty -a
... swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; ...
要删除映射,请更改终端特性以取消定义上述特殊字符(即 stop
和 start
)
# stty stop undef # stty start undef
要在启动时自动删除这些映射,您可以将前面两条命令添加到 ~/.bashrc
文件中。
附加提示
用于无头服务器的 Systemd 服务
此单元文件依赖于运行名为 rtorrent 的单个用户并将 rtorrent 配置为作为守护进程运行。
创建以下文件
/etc/systemd/system/rtorrent.service
[Unit] Description=rTorrent System Daemon After=network.target [Service] Type=simple User=rtorrent Group=rtorrent # Modify the next 2 lines to use absolute paths ExecStartPre=-/bin/rm -f /<home>/.session/rtorrent.lock ExecStart=/usr/bin/rtorrent Restart=on-failure RestartSec=3 [Install] WantedBy=multi-user.target
作为用户守护进程的 Systemd 服务
此单元将允许多个用户或单个用户以守护进程身份运行 rtorrent。
要在启动时启动 rtorrent,启用 rtorrent@user
(其中 user
是将运行 rtorrent 的用户)。
创建以下文件
/etc/systemd/system/rtorrent@.service
[Unit] Description=rTorrent for %i After=network.target [Service] Type=simple User=%i Group=%i WorkingDirectory=/home/%i # Modify the next line to the absolute path for rtorrent.lock, for example ExecStartPre=-/bin/rm -f /home/%i/.session/rtorrent.lock ExecStart=/usr/bin/rtorrent -o system.daemon.set=true Restart=on-failure RestartSec=3 [Install] WantedBy=multi-user.target
使用 tmux 或 screen 的 Systemd 服务
以下服务的使用取决于服务单元的类型。
对于系统服务(在 /etc/systemd/system/ 中)
在启动时启动
# systemctl enable rtorrent
手动启动
# systemctl start rtorrent
停止
# systemctl stop rtorrent
确保创建了 'rtorrent' 用户,并在相应的 home 目录中放置了 rtorrent.rc。
对于用户服务(在 /etc/systemd/user/ 中)
$ systemctl --user enable rtorrent
手动启动
$ systemctl --user start rtorrent
停止
$ systemctl --user stop rtorrent
使用 screen
- 作为系统服务单元
/etc/systemd/system/rtorrent.service
[Unit] Description=rTorrent After=network.target [Service] Type=forking KillMode=none User=rtorrent ExecStartPre=/usr/bin/bash -c "if test -e %h/.rtorrent_session/rtorrent.lock && test -z `pidof rtorrent`; then rm -f %h/.rtorrent_session/rtorrent.lock; fi" ExecStart=/usr/bin/screen -dmfa -S rtorrent /usr/bin/rtorrent ExecStop=/usr/bin/bash -c "test `pidof rtorrent` && killall -w -s 2 /usr/bin/rtorrent" WorkingDirectory=%h Restart=on-failure [Install] WantedBy=multi-user.target
- 作为用户服务单元
/etc/systemd/user/rtorrent.service
[Unit] Description=rTorrent After=network.target [Service] Type=forking KillMode=none ExecStart=/usr/bin/screen -dmfa -S rtorrent /usr/bin/rtorrent ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent WorkingDirectory=%h [Install] WantedBy=default.target
附加到 rtorrent 的会话
screen -D -r rtorrent
分离
Ctrl-a d
使用 tmux
- 使用独立的 tmux 服务器(如果崩溃则重启 rtorrent)
~/.config/systemd/user/rtorrent.service
[Unit] Description=rtorrent After=network.target [Service] Type=forking ExecStartPre=/usr/bin/bash -c "if test -e ~/.session/rtorrent.lock && test -z `pidof rtorrent`; then rm -f ~/.session/rtorrent.lock; fi" ExecStart=/usr/bin/tmux -L rt new-session -s rt -n rtorrent -d rtorrent ExecStop=/usr/bin/bash -c "/usr/bin/tmux -L rt send-keys -t rt:rtorrent.0 C-q; while pidof rtorrent > /dev/null; do echo stopping rtorrent...; sleep 1; done" Restart=on-failure [Install] WantedBy=default.target
- 使用作为用户 rtorrent 运行的 tmux(如果崩溃则重启 rtorrent)
/etc/systemd/system/rtorrent.service
[Unit] Description=rTorrent Daemon After=network.target [Service] Type=forking KillMode=none User=rtorrent ExecStart=/usr/bin/tmux new-session -c /mnt/storage/rtorrent -s rtorrent -n rtorrent -d rtorrent ExecStop=/usr/bin/bash -c "/usr/bin/tmux send-keys -t rtorrent C-q && while pidof rtorrent > /dev/null; do sleep 0.5; done" WorkingDirectory=%h Restart=on-failure [Install] WantedBy=multi-user.target
附加到 rtorrent 的会话
tmux -L rt attach -t rt tmux attach -t rt
分离
Ctrl-b d
使用 dtach 的 systemd 服务文件
从 systemd 单元运行 dtach 时,必须显式设置 TERM
环境变量,rtorrent 才能工作。
此服务文件没有重启,因为作者偶尔会使相关驱动器脱机,并且 rtorrent 在这种情况下启动时会发生故障,我们不妨说“欠佳”,并且会丢失许多 torrent 特定设置,例如每个 torrent 存储在其中的特定目录。实际上,启动 rtorrent 的符号链接位于相关驱动器上;如果卸载了驱动器,rtorrent 将无法启动。阻止 rtorrent 启动的这种用例与将下载的文件放在 NAS、USB 或 eSATA 驱动器等可移动媒体上的用户相关。
~/.config/systemd/user/rtorrent.service
[Unit] Description=rTorrent #After=network.target [Service] # set TERM according to your terminal Environment="TERM=xterm" #Environment="TERM=linux" Type=forking KillMode=none ExecStart=-/usr/bin/dtach -n /home/sam/run/dtach_fifos/fifo -e "^T" /home/sam/bin/rtr_new -n -o import=/home/sam/.config/rtorrent/new_.rc # dtach -n <separate filename for each instance> # # rtr_new -n to ignore the default .rtorrent.rc # rtr_new -o import to load the instance-specific rc ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_new [Install] WantedBy=multi-user.target
注意此服务文件中暴露的其他一些问题,而不仅仅是 dtach
/home/sam/bin/rtr_new
是指向 /usr/bin/rtorrent
的符号链接
这使我们可以运行多个实例,并使用不同版本的 ExecStop 独立杀死每个实例,即
ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_new ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_academic ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_other_stuff
这些都在不同的服务文件中,每个文件控制一个实例。
如果没有此步骤,当运行多个实例时,killall 解决方案将杀死所有正在运行的 rtorrent 实例。
如果不需要多个 rtorrent 实例,并且 rtorrent rc 文件位于默认位置,则可以简化上述服务文件。包含整个文件,但仅 ExecStart 和 ExecStop 行更改。
~/.config/systemd/user/rtorrent.service
[Unit] Description=rTorrent #After=network.target [Service] # set TERM according to your terminal Environment="TERM=xterm" #Environment="TERM=linux" # Type=forking is not required if ExecStart command is run using dtach -N (i.e dtach will run on foreground). Type=forking KillMode=none ExecStart=-/usr/bin/dtach -n /home/sam/run/dtach_fifos/fifo -e "^T" /usr/bin/rtorrent # dtach -n <user specified FIFO name> -e <user specified character> /usr/bin/rtorrent ExecStop=/usr/bin/killall -w -s INT /usr/bin/rtorrent # -e (exact match) and -u (user name) were added above to stop specific processes # and may be omitted here because only one rtorrent will be running [Install] WantedBy=multi-user.target
注意 `ExecStart=-/usr/bin/dtach` 部分中的连字符,这也允许故障退出代码表示成功终止。这可能是由于当前问题 [1]。另一种方法是在服务部分中使用 `SuccessExitStatus=1`。
该服务可以作为 用户单元 进行控制。启动后,您可以附加到会话
$ dtach -a /home/sam/run/dtach_fifos/fifo -e "^T"
预分配
rTorrent 能够为 torrent 预分配空间。主要好处是它可以限制和避免文件系统的碎片化。但是,如果文件系统本身不支持 fallocate syscall,这将导致预分配期间出现延迟。
因此,建议 xfs、ext4、btrfs 和 ocfs2 文件系统使用此开关,这些文件系统具有本机 fallocate syscall 支持。它们在预分配期间不会看到延迟,也不会出现碎片化的文件系统。在其他文件系统上进行预分配将导致延迟,但不会使文件碎片化。
要启用它,请将以下内容添加到您的 ~/rtorrent.rc
~/rtorrent.rc
# Preallocate files; reduces defragmentation on filesystems. system.file.allocate = 1
要在上述文件系统以外的文件系统上提供预分配功能(尽管会有延迟),您可以从 ABS 树重新编译 libTorrent,并使用以下新开关
$ ./configure --prefix=/usr --disable-debug --with-posix-fallocate
有关更多信息,请参阅 上游文档
管理已完成的文件
使用监视文件夹
可以使 rtorrent 根据您将 *.torrent 拖放到哪个“监视”文件夹中来组织已完成的 torrent 数据到特定文件夹,同时继续做种。
作为解决方案,请在您的 ~/.rtorrent.rc
中使用以下示例。确保更改路径。
# default path for in progress downloads directory = /home/user/torrents/incomplete # schedule a timer event named 'watch_directory_1': # 1) triggers 10 seconds after rtorrent starts # 2) triggers at 10 second intervals thereafter # 3) Upon trigger, attempt to load (and start) new *.torrent files found in /home/user/torrents/watch/ # 4) set a variable named 'custom1' with the value "/home/user/torrents/complete" # NOTE: if you do not want it to automatically start the torrent, change 'load.start' to 'load.normal' schedule2 = watch_directory_1,10,10,"load.start=/home/user/torrents/watch/*.torrent,d.custom1.set=/home/user/torrents/complete" # upon completion, move content to path specified above via custom1 method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))" method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session=" method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1="
您可以像这样添加其他监视目录和相应的完成目录
directory = /home/user/torrents/incomplete schedule2 = watch_directory_1,10,10,"load.start=/home/user/torrents/watch/*.torrent,d.custom1.set=/home/user/torrents/complete" schedule2 = watch_directory_2,10,10,"load.start=/home/user/torrents/watch/iso/*.torrent,d.custom1.set=/home/user/torrents/complete/iso" schedule2 = watch_directory_3,10,10,"load.start=/home/user/torrents/watch/music/*.torrent,d.custom1.set=/home/user/torrents/complete/music" method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))" method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session=" method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1="
您还可以为每个监视目录指定不完整的目录
directory = /home/user/torrents/incomplete schedule2 = watch_directory_1,10,10,"load.start=/home/user/torrents/watch/*.torrent,d.directory.set=/home/user/torrents/incomplete,d.custom1.set=/home/user/torrents/complete" schedule2 = watch_directory_2,10,10,"load.start=/home/user/torrents/watch/iso/*.torrent,d.directory.set=/home/user/torrents/incomplete/iso,d.custom1.set=/home/user/torrents/complete/iso" schedule2 = watch_directory_3,10,10,"load.start=/home/user/torrents/watch/music/*.torrent,d.directory.set=/home/user/torrents/incomplete/music,d.custom1.set=/home/user/torrents/complete/music" method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))" method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session=" method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1="
另请参阅 通过 bash 脚本完成移动,以及通过 pyrocore 的 rtcontrol(有一个 AUR 软件包)。
不使用监视文件夹
如果您希望 rtorrent 自动按标签管理已完成的文件夹位置,请将以下内容添加到您的 rtorrent.rc 配置文件中,并修改路径以适合您的环境
# Check if destination dir is not Null method.set_key = event.download.inserted_new,check_dest_dir, \ "branch=d.custom=storagedir,,\ \"d.custom.set=storagedir,/path/to/download/directory\"" # Modify destination dir according to tv label method.set_key = event.download.inserted_new,update_dest_dir_tv, \ "branch=\"equal={d.custom1=, cat=TV}\",\ \"d.custom.set=storagedir,/path/to/tv/dir\"" # Modify destination dir according to movies label method.set_key = event.download.inserted_new,update_dest_dir_movies, \ "branch=\"equal={d.custom1=, cat=Movies}\",\ \"d.custom.set=storagedir,/path/to/movie/dir\"" # Move files of completed torrents method.set_key = event.download.finished,move_completed, \ "d.directory.set=$d.custom=storagedir; \ execute2={mv,-u,$d.base_path=,$d.custom=storagedir}"
一个用例是,如果您正在使用 ZFS 并且需要将源材料放在同一文件系统上。rTorrent 将下载到临时 NVMe/SSD,然后将内容移动到 ZFS 文件系统,*arrs 可以在其中处理媒体并硬链接到媒体服务器将抓取的单独文件夹。
使用 Google mail 通知
手机提供商允许您通过“电子邮件”发送到您的手机
Verizon: 10digitphonenumber@vtext.com AT&T: 10digitphonenumber@txt.att.net Former AT&T customers: 10digitphonenumber@mmode.com Sprint: 10digitphonenumber@messaging.sprintpcs.com T-Mobile: 10digitphonenumber@tmomail.net Nextel: 10digitphonenumber@messaging.nextel.com Cingular: 10digitphonenumber@cingularme.com Virgin Mobile: 10digitphonenumber@vmobl.com Alltel: 10digitphonenumber@alltelmessage.com OR 10digitphonenumber@message.alltel.com CellularOne: 10digitphonenumber@mobile.celloneusa.com Omnipoint: 10digitphonenumber@omnipointpcs.com Qwest: 10digitphonenumber@qwestmp.com Telus: 10digitphonenumber@msg.telus.com Rogers Wireless: 10digitphonenumber@pcs.rogers.com Fido: 10digitphonenumber@fido.ca Bell Mobility: 10digitphonenumber@txt.bell.ca Koodo Mobile: 10digitphonenumber@msg.koodomobile.com MTS: 10digitphonenumber@text.mtsmobility.com President's Choice: 10digitphonenumber@txt.bell.ca Sasktel: 10digitphonenumber@sms.sasktel.com Solo: 10digitphonenumber@txt.bell.ca
- 安装 mailx,它由 s-nail 软件包提供。
- 清除
/etc/mail.rc
文件并输入
set sendmail="/usr/bin/mailx" set smtp=smtp.gmail.com:587 set smtp-use-starttls set ssl-verify=ignore set ssl-auth=login set smtp-auth-user=USERNAME@gmail.com set smtp-auth-password=PASSWORD
现在要发送文本,我们必须将消息管道传输到 mailx 程序。
- 制作 Bash 脚本
/path/to/mail.sh
echo "$@: Done" | mailx 5551234567@vtext.com
其中 $@ 是一个变量,保存传递给脚本的所有参数。
- 最后,添加重要的
~/.rtorrent.rc
行
method.set_key = event.download.finished,notify_me,"execute2=/path/to/mail.sh,$d.name="
分解
notify_me
是命令 ID,其他命令可能会使用它,它可以是您喜欢的任何东西,只要它是唯一的。
execute=
是 rtorrent 命令,在本例中是执行 shell 命令。
/path/to/mail.sh
是我们的脚本的名称(或您要执行的任何命令),后跟以逗号分隔的所有开关/参数列表。
$d.get_name=
'd' 是触发命令的任何下载的别名,get_name 是一个返回下载名称的函数,'$' 告诉 rTorrent 在调用 execute 之前用其输出替换命令。
最终结果?当 torrent “All Live Nudibranches”在我们离开工作之前开始下载完成时,我们将收到短信
All Live Nudibranches: Done
UI 技巧
默认情况下,rTorrent 不会正确列出活动选项卡,将此行添加到您的 .rtorrent.rc
中以仅显示活动 torrent
schedule2 = filter_active,30,30,"view.filter = active,\"or={d.up.rate=,d.down.rate=}\""
然后按 rTorrent 客户端中的 9
以查看操作中的更改。
要按上传速率对做种视图进行排序,并且仅显示具有对等方的 torrent
# Sort the seeding view by the upload rate and only show torrents with peers view.sort_current = seeding,greater=d.up.rate= view.filter = seeding,"and=d.complete=,d.peers_connected=" view.sort_new = seeding,less=d.up.rate= view.sort = seeding
要按上传速率对完成视图进行排序
# Sort the complete view by the upload rate view.sort_current = complete,greater=d.up.rate= view.filter = seeding,"and=d.complete=" view.sort_new = seeding,less=d.up.rate= view.sort = seeding
手动向 torrent 添加 trackers
- 从 rTorrent 控制台视图中选择要编辑的 torrent。
- 点击
Ctrl+x
。 - 如果您有四个 tracker,请一次键入以下行(始终先按
Ctrl+x
),例如添加另外四个
d.tracker.insert="5","udp://tracker.publicbt.com:80" d.tracker.insert="6","udp://tracker.openbittorrent.com:80" d.tracker.insert="7","udp://tracker.istole.it:80" d.tracker.insert="8","udp://tracker.ccc.de:80"
计划 torrent 在特定时间启动
如果您不想立即下载 torrent,并且希望稍后开始下载(例如,为了适应数据计划),您可以将 torrent 添加到特定目录,并告诉 rtorrent 定期检查该目录,如果存在 torrent 文件,rtorrent 将在指定时间开始下载
# Start torrents at 1am in this directory schedule2 = watch_start,01:00:00,24:00:00, "load.start=/home/user/torrents/offpeak/*.torrent"
rtorrent 将每 24 小时检查目录 torrents/offpeak/
,如果存在 torrent 文件,则将在凌晨 01:00 启动它。
故障排除
CA 证书
默认情况下,rTorrent 将与使用带有有效证书的 HTTPS 的 tracker 一起工作。如果 HTTPS tracker 因其具有自定义或不寻常的证书而被拒绝,您可能需要下载并单独验证它。
完成此操作后,您可以通过以下方式通知 rTorrent 新证书
$ rtorrent -o http_capath=/etc/ssl/certs/www.your-tracker.com.pem
有关更多信息,请参见
- rTorrent + SSL 指南 下载和验证新 HTTPS 证书的完整说明。
- rTorrent 错误 & CA 证书
- rTorrent 证书问题
- rtorrent 设置
在 rTorrent 0.8.9 及更高版本中,您可以通过设置 network.http.ssl_verify_peer.set=0
和 network.http.ssl_verify_host.set=0
完全禁用 HTTPS 检查,来源。
锁定的目录
rTorrent 有时会在崩溃或不正确的关机后锁定,并会抱怨锁定文件。
根据错误消息,可以在下载目录的隐藏文件夹 .rtorrentsession
中找到名为“rtorrent.lock”的文件并手动删除。
Event failed: bad return code
这通常是由于 system.method.* 行中有空格,或者事件处理程序调用未安装或返回非零退出代码的外部脚本引起的。
对于前者,删除任何多余的空格,否则引用路径等(如果它们是有意的),它将正常工作。
Web 界面
rTorrent 有许多基于 Web 的前端;最活跃的包括以下内容
- ruTorrent - 具有与 μTorrent 非常相似的界面,并支持许多插件和高级功能(另请参阅:RTorrent/RuTorrent 和 论坛上的指南)。
- Flood - 现代界面,使用 XMLRPC 在 Node.js 中编写。
XMLRPC 接口
Unix 套接字
如果您想将 rTorrent 与 Web 界面一起使用,则需要将以下行添加到配置文件中,将 user 替换为运行 rTorrent 的用户
network.scgi.open_local = /home/user/rpc.socket execute.nothrow = chmod,770,/home/user/rpc.socket
您还必须通过 ACL(访问控制列表)授予所选 Web 界面对 Unix 套接字的访问权限,将 <user> 和 <group> 替换为 Web 界面在安装时生成的用户和组(如果 rtorrent 和 Web 服务器不共享公共用户或组,则无法访问 unix 套接字)
setfacl -m u:<user>:rwx,g<group>:rwx /home/user/rpc.socket
这将授予所选 Web 界面对套接字的读取、写入和执行权限。
有关更多信息,请参阅:将 XMLRPC 与 rtorrent 结合使用
SCGI 端口
network.scgi.open_port = localhost:5000
在监视文件夹中将 magnet 链接另存为 torrent 文件
如果您希望将 magnet 链接自动添加到您的监视文件夹,这是一个可以实现此目的的脚本
#!/bin/bash watch_folder=~/.rtorrent/watch cd $watch_folder [[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit; echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent"
(改编自 https://blog.gonzih.me/blog/2012/02/17/how-to-use-magnet-links-with-rtorrent/)。
保存它,例如作为 rtorrent-magnet,赋予它执行权限,并将其放置在 $PATH 下的某个位置。然后在 Firefox 中
- 在地址栏中键入
about:config
并按Enter
。 - 右键单击:新建 > 布尔值 > 名称:network.protocol-handler.expose.magnet > 值 > false。
- 下次单击 magnet 链接时,系统将询问您要使用哪个应用程序打开它。选择我们刚刚创建的脚本,您就完成了。
如果您希望 xdg-open 处理此问题,如果您使用 chrome 而不是 Firefox,则需要这样做(尽管 gnome 和其他 DE 可能有自己的程序覆盖 xdg-open),您需要在 ~/.local/share/applications/rtorrent-magnet.desktop
中为 rtorrent-magnet 脚本创建桌面条目,内容如下
[Desktop Entry] Type=Application Name=rtorrent-magnet Exec=rtorrent-magnet %U MimeType=x-scheme-handler/magnet; NoDisplay=true
然后,您需要做的就是使用以下命令注册 mimetype
$ xdg-mime default rtorrent-magnet.desktop x-scheme-handler/magnet
Magnet 转 torrent
您还可以使用 magnet2torrent-gitAUR 软件包,该软件包下载元数据并创建 torrent 文件。
如何使用
$ magnet2torrent -m <magnet link> -o [torrent file]
或使用 aria2 和 xclip,从剪贴板处理 magnet 链接
$ d=$(xdg-user-dir DOWNLOAD) $ c=$(xclip -o -selection clipboard | grep ^magnet) $ aria2c -d "$d" --input-file <( echo "$c" ) --bt-metadata-only=true --bt-save-metadata=true
rtorrent-ps
rTorrent-PS 是 rTorrent 发行版,以补丁集的形式提供,具有 UI 增强、着色和一些附加功能。
安装
安装 rtorrent-psAUR。
配置
在您的 rTorrent 配置文件中将“pyro.extended”设置为 1 以激活 rTorrent-PS 功能。
method.insert = pyro.extended, value|const, 1
有关其他配置示例,请参阅 pimp-my-box 存储库的 rtorrent-ps 模板。请注意,它们可能需要 PyroScope 命令行实用程序才能工作。
PyroScope 命令行实用程序
PyroScope 命令行实用程序 是 rTorrent 客户端的工具集合,可与 #rtorrent-ps 补丁集很好地协同工作。除其他外,它们还为常见任务提供自动化,并为 rTorrent 提供队列管理器。
请遵循 官方文档 进行安装和配置。有关其他配置示例,请参阅 pimp-my-box 存储库的 rtorrent-ps 模板。
参见
- RTorrent/RuTorrent
- GNU Screen
- rTorrent 手册 - 包括基本和高级配置的说明、脚本编写指南以及(尚未)完整的命令参考和自动生成的索引。
- rtorrent(1)
- Wikipedia 上 BitTorrent 客户端的比较
- rTorrent 社区 Wiki - 用于发布有关 rTorrent 和任何与 rTorrent 相关的项目的信息的公共场所,涉及设置、配置、操作和开发。
- pyrocore - rTorrent 的命令行工具集合。它提供用于创建和修改 torrent 文件、在完成时移动数据而无需多个监视文件夹的命令,以及通过 rTorrent 的 XML-RPC 接口批量控制下载项的命令:搜索、启动/停止、删除项(包括或不包括其数据)等。它还提供记录在案的 Python API。
- Linux 上 rTorrent 和 Pyroscope 的安装指南 - BitTorrent 协议的工具集合,尤其是 rTorrent 客户端
- mktorrent - 用于生成 torrent 文件的命令行应用程序,可作为 mktorrent 使用。
- docktorrent - 使用 Docker、rTorrent 和 ruTorrent 运行功能齐全的 BitTorrent 盒子。
- reptyr - 另一个接管程序 TTY 的工具(它在标准存储库中)。该进程可能已开始连接到终端或 tmux、screen 或 dtach 中的套接字。
- neercs - 一个比 reptyr 更像 screen/tmux 的工具,但是,像 reptyr 一样,neercs 也可以“窃取”可能已开始从属于终端或 tmux、screen 或 dtach 中的套接字的进程。
论坛帖子
- 2009-03-11 - Arch Linux - HOWTO: Conky 中的 rTorrent 统计信息