
[script, bug] KTorrent.queue()
KT ver. 3.3.4
KTorrent.queue(tor.infoHash()) spits out an "PythonInterpreter::extracException"
Also, this might not be a bug, but KTorrent.start(tor.infoHash()) does not start a torrent that's in a "Seeding Complete" state. I was manually dropping the Ratio limit below it's Share ratio for testing. Since I can't change the ratio limit in self.changePriority(tor) prior to issuing a start, the torrent not starting may be the expected behaviour, but figured I'd bring it up in case. (I was expecting it to start, e.g. be place in a Queued for Seeding state, and when entering the Seeding state be kicked back to Seeding complete.)
Latest scratch code :
Code:
#!/usr/bin/env kross
# -*- coding: utf-8 -*-
import KTorrent
import KTScriptingPlugin
import Kross
class StatusChanged:
def __init__(self):
KTorrent.log("===========> Starting StatusChanged Script")
KTorrent.connect("torrentAdded(const QString &)",self.torrentAdded)
tors = KTorrent.torrents()
# bind to signals for each torrent
for t in tors:
self.torrentAdded(t)
def changePriority(self,tor):
tor.setPriority(1)
KTorrent.orderQueue()
KTorrent.log("===========> We are finished with: %s, %s Priority has been changed to: %i, and it's been re-queued." % (tor.name(),tor.infoHash(),tor.priority()))
KTorrent.start(tor.infoHash())
KTorrent.queue(tor.infoHash())
def torrentFinished(self,tor):
self.changePriority(tor)
def seedingAutoStopped(self,tor,reason):
self.changePriority(tor)
def connectSignals(self,tor):
KTorrent.log("connectSignals " + tor.name())
tor.connect("finished(QObject* )",self.torrentFinished)
tor.connect("seedingAutoStopped(QObject* ,const QString & )",self.seedingAutoStopped)
def torrentAdded(self,ih):
tor = KTorrent.torrent(ih)
self.connectSignals(tor)
statchange = StatusChanged()
def unload():
global statchange
del statchange