Deluge “unregistered torrent” 修复脚本

Feral Hosting设置

获取 daemon 信息

printf "10.0.0.1\n$(hostname -f)\n$(whoami)\n$(sed -rn 's/(.*)"daemon_port": (.*),/\2/p' ~/.config/deluge/core.conf)\n$(sed -rn "s/$(whoami):(.*):(.*)/\1/p" ~/.config/deluge/auth)\n"

参见:https://www.feralhosting.com/wiki/software/deluge

修复脚本

autodldeluge.sh

进入存放脚本的文件夹

cd /media/md1/nneeww/private/deluge

cd ~/private/deluge

新建脚本并复制进以下代码,注意修改地址,端口,用户和密码

nano autodldeluge.sh
#!/bin/bash
torrentid=$1
torrentname=$2
torrentpath=$3

x=1
while [ $x -le 100 ]
do
sleep 2
echo "Running $x times" >> ~/script.log
echo "TorrentID: $torrentid" >> ~/script.log
line=$(deluge-console "connect 127.0.0.1:<port>; info" $1 | grep "Tracker status")
echo "$line" >> ~/script.log
case "$line" in
*unregistered*|*Unregistered*)
deluge-console "connect 127.0.0.1:<port>; pause '$torrentid'"
sleep 3
deluge-console "connect 127.0.0.1:<port>; resume '$torrentid'"
;;
*)
echo "Found working torrent: $torrentname $torrentpath $torrentid" >> ~/script.log
exit 1;;
esac
x=$(( $x + 1 ))
done
chmod +x autodldeluge.sh

启用 Execute 插件

Preferences –> Plugins 启用 “Execute”

然后 Preferences –> Execute,Add,Event 选 Torrent Added

命令

/media/md1/nneeww/private/deluge/autodldeluge.sh

参见:https://kb.ultraseedbox.com/pages/viewpage.action?pageId=7373002

Deluge Console

格式

deluge-console "connect <host>[:<port>] <user> <password> ; add $(TorrentPathName) ; exit"

参见:https://dev.deluge-torrent.org/wiki/UserGuide/ThinClient

Deluge 基本命令

启动

deluged

检查运行

pgrep -fu "$(whoami)" "deluged"

停止

pkill -fu "$(whoami)" 'deluged'

重启

pkill -fu "$(whoami)" 'deluged' && sleep 3 && deluged

参见:https://www.feralhosting.com/wiki/software/deluge