This forum has been archived. All content is frozen. Please use KDE Discuss instead.

torrentAdded not changing priority

Tags: None
(comma "," separated)
George
Moderator
Posts
5421
Karma
1
Looking at the code, it seems that the torrentAdded signal is emitted first and then the QM is told it can manage the torrent.

The result is that whatever you do in the torrentAdded signal handler, it is overwritten by the QM. I will reverse this order, so you can override what the QM does in the signal handler.

PSS: Did this from a clean startup, as torrentAdded compounds (appends?) everything you run with it. e.g. It never unloads anything, even if you remove the script. So, if you've run the script ten times during testing you'll end up with all ten torrentAdded's code being run.


It's the way kross works. You need to manually cleanup things. For this you need to implement the unload method:

http://ktorrent.org/wiki/index.php/Writ ... ts#Cleanup
George
Moderator
Posts
5421
Karma
1
This is fixed in revision 1099521
George
Moderator
Posts
5421
Karma
1
Sam wrote:Hi George,

SVN: 1103868

Code: Select all
   def unload(self):
      KTorrent.disconnect("torrentAdded(const QString &)",self.torrentAdded)


The code above doesn't seem to unload torrentAdded (still getting multiple log entries). I'm just guessing at the proper syntax, is there a typo?


No syntax is OK, there is some problem with Kross where you can't seem to unload scripts, I need to get to the bottom of this.
Disconnects not working, seems to be related to this.

Also, it seems the fix you made in revision 1099521 to stop the torrentAdded signal handler being overwritten by the QM didn't make it into 1103868.

Code: Select all
   def torrentAdded(self,info_hash):
      tors = KTorrent.torrents()
      tor.setPriority(len(tors))
      KTorrent.orderQueue()
      KTorrent.log("=2========>    torrentAdded=%s,  Priority = %i, " % (tor.name(),tor.priority()))


orderQueue properly sets the priority, but........ The orderQueue does not [re-sort?] the queue correctly. Not sure what to call it, the torrent has the right priority to go to the top of the queue, but after everything completes the torrent ends up back at the bottom of the queue.


That code seems to work here, newly added torrents get top priority

Update:
Another needle for this haystack...

Stripping out Chunk downloaded, etc., this is the message I got from a manual orderQueue, where the torrent had not preallocated any of the files.

Code: Select all
Preallocating file {filename} (nnn bytes)
The torrent blah has stalled longer than 360 minutes, decreasing it's priority
QM Stopping: blah
Saving 0 chunk downloads
Saving list of peers to ...../peer_list


The torrent's Time Dowloaded is 2 minutes 19 seconds, and it's back at the bottom of the queue. If I run a second manual orderQueue on it, it happily goes back to the top of the queue.


I think I see what the problem is, the last activity timestamps are initialized after preallocation is done. Need to do that before preallocation.
George
Moderator
Posts
5421
Karma
1
I had a look at the kross python code, and the reason why disconnect doesn't work, is that it isn't implemented.


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]