or another way, works better than calling deluge-console over and over using deluge-client package.
deluge-client (
https://github.com/JohnDoee/deluge-client)
pip3 install deluge-client
Code: Select all
#!/usr/bin/python3
import time,sys
from deluge_client import DelugeRPCClient
tID = sys.argv[1]
dHost = "127.0.0.1"
dPort = 58846
dUser = "user"
dPass = "pass"
client = DelugeRPCClient(dHost,dPort,dUser,dPass)
client.connect()
while client.connected == False:
time.sleep(3)
client = DelugeRPCClient(dHost,dPort,dUser,dPass)
client.connect()
time.sleep(3)
tData = client.call('core.get_torrent_status',tID,{})
while tData[b'state'] == b'Downloading' or tData[b'state'] == b'Paused':
if len(tData[b'peers']) < 2:
client.call('core.pause_torrent',tID)
time.sleep(1)
client.call('core.resume_torrent',tID)
time.sleep(2)
client.call('core.force_reannounce',[tID])
time.sleep(3)
tData = client.call('core.get_torrent_status',tID,{})
else:
exit()
exit()
add your client details in the vars, add as to Execute plugin under Torrent Added. Script will run and check number of peers while state of the torrent is "Downloading". If peers is less than 2 while in this state it will pause, resume and recheck the state and number of peers and repeat until either the torrent state changes or the number of peers has been met.
Very simple to help with the unrecognised torrent error with private trackers used with autodl-irssi.