如何在 rTorrent 中从 Firefox 打开磁力种子链接?

and*_*.46 5 command-line firefox scripts 16.04 rtorrent

我在 Xenial Xerus 下使用命令行 Torrent 客户端rTorrent,我想:

  1. 使用 Firefox查找并单击磁力种子链接
  2. 在 rTorrent 中自动打开磁力链接并开始下载

我相信需要从 Firefox 内部调用一个脚本,但到目前为止编写这样的脚本已经打败了我......

小智 5

问题通常在于 MIME 类型和默认处理程序。

首先,您是否更改了 Firefox 的about:config设置?IE:

network.protocol-handler.expose.magnet -> false
Run Code Online (Sandbox Code Playgroud)

根据此 Firefox 洪水问答重置其他选项

你有没有设置 rTorrent 来观看任何特定的目录?

文件:~/.rtorrent.rc

# Maximum and minimum number of peers to connect to per torrent.
min_peers = 50
max_peers = 80

# Maximum number of simultanious uploads per torrent.
max_uploads = 5

# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0
upload_rate = 50

# Default directory to save the downloaded torrents.
directory = $HOME/torrents/downloads

# Watch a directory for new torrents
# SET your watch directory here --v 
schedule = watch_directory,5,5,$HOME/torrents/watch/*.torrent

port_range = 60125-64125
port_random = yes
dht = auto

# UDP port to use for DHT.
dht_port = 63425

# Enable peer exchange (for torrents not marked private)
peer_exchange = yes

# Check hash for finished torrents.
check_hash = yes

encryption = allow_incoming,try_outgoing ,enable_retry
Run Code Online (Sandbox Code Playgroud)

然后就是“另存为”到$HOME/torrents/watch.

更改$HOME/torrents/watch为您使用的任何 torrents 子文件夹,或者至少将 $HOME 更改为 /home/username

创建一个文件并添加以下脚本:

文件:maglink-rtorrent.sh

#!/bin/bash

cd $HOME/torrents/watch    # set your watch directory here
[[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit;
echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent"
Run Code Online (Sandbox Code Playgroud)

不要忘记让它可执行

chmod +x maglink-rtorrent.sh
Run Code Online (Sandbox Code Playgroud)

这也提供了从终端下载的能力:

cd $HOME/torrents/watch
./maglink-rtorrent.sh "MAGNET-LINK-HERE"
Run Code Online (Sandbox Code Playgroud)

更多很棒的服务技巧和 rTorrent 设置选项在这里

进一步的学分:

更新 2:

如果不使用 rTorrent,而是使用 kTorrent 或 qBittorent,那么以下是运行它的方法:

# check defaults
xdg-mime query default x-scheme-handler/magnet
gvfs-mime --query x-scheme-handler/magnet

# set defaults
xdg-mime default qBittorent.desktop x-scheme-handler/magnet
gvfs-mime --set x-scheme-handler/magnet qBittorrent.desktop
Run Code Online (Sandbox Code Playgroud)

是否需要命令行还有一个进一步的设置(从内存中)。

不过,对于 rTorrent,此链接是FlexGet rTorrent Magnet URI 处理程序

完整信息在这里。

希望这可以帮助。

  • 我已经设法自己破解了这个:http://paxmontem.blogspot.com.au/2012/03/magnet-links-in-arch-linux-with.html 但我很乐意获奖如果你能以这种方式弯曲你的答案,那么奖金...... (2认同)