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

[Scripting] Desired additional Functions / Signals

Tags: None
(comma "," separated)
George
Moderator
Posts
5421
Karma
1
tor.GetinfoHash(priority) | Return the infoHash of a torrent, the priority of the torrent needs to be given as the parameter.


Why is this necessary ? What does the priority have to do with the info hash ?

As for the global hooks, currently all the signals you can connect to are internally emitted by the torrent themselves, so they are just routed to the scripts. It is possible to just additionally add them to the KTorrent module, so you only have to connect to one signal for all torrents.
George
Moderator
Posts
5421
Karma
1
Sam wrote:
George wrote:
tor.GetinfoHash(priority) | Return the infoHash of a torrent, the priority of the torrent needs to be given as the parameter.


Why is this necessary ? What does the priority have to do with the info hash ?


Necessary? Technically none of my requests are necessary. I wanted to be able to grab a specific torrent based upon its priority without having to loop through the entire priority queue.

An Example:
+ Check last torrrent in queue's time downloaded, if zero, reassign priority to top of queue.


A function like that does not exist in KT itself, the scripting API in my opinion should only export what is available in KT, and not add some additional stuff which might make life easier for some very specific scripts.

George wrote:As for the global hooks, currently all the signals you can connect to are internally emitted by the torrent themselves, so they are just routed to the scripts. It is possible to just additionally add them to the KTorrent module, so you only have to connect to one signal for all torrents.


Well, that's disturbing. The reason I wanted a global hook is that if you cycle through all torrents and issue each a hook, then KT hangs (and drops peers, basically stops all activity) until the for loop is finished. If you issue a global hook, then there is no noticeable effect.

Which leads me to believe the kross-python scripting is orders of magnitude slower than the KT binary. Which I guess also supports my desire for a single global hook. But also puts a crimp in my idea to write you a fully configurable script based queue manager. (I say widget based, but I looked at that in 2.x and gave up.)


It's interpreted code, it is always going to be slower. However if some call is really slow, I would like to know about it, maybe things can be improved.

You have X amount of time, and I'm sure there's better things for you to be doing KT related than playing with 'window dressing.'** Besides which, it would offload a major section to the user community who have the capability to contribute at a script level, but not necessarily at a svn level.

# # #

I'll re-label the above with what is most useful/needed and then finish compiling the svn copy of KT I have and re-Q&A everything I've been doing with scripts and see how I can help then.

Best Regards,

Sam
** Uhg, not that the QM isn't important, it is, but we can write it if you give us the tools :)


I have so many things to do, but the scripting definitely needs to be improved and expanded, to become really useful.
George
Moderator
Posts
5421
Karma
1
Those functions were added in 4.0beta2
George
Moderator
Posts
5421
Karma
1
I will see what is going wrong.
George
Moderator
Posts
5421
Karma
1
It's fixed now, it turns out krosspython does not like it if you use float in your function return type or argument list. Using doubles instead of floats fixes the problem.
George
Moderator
Posts
5421
Karma
1
Sam wrote:Hi George,

Can you use Decimal instead of double?

Code: Select all
tor.setMaxShareRatio(3.33)
tor.setMaxSeedTime(5.95)

getMaxShareRatio = 3.32999992371
getMaxSeedTime = 5.94999980927



Probably the double to float conversion internally, I could change it to double everywhere, but I don't think these small rounding errors will make much difference.

And while you're in there ;) can you add tor.currShareRatio() and tor.currSeedTime()? Or, tell me the filename you're doing the API in and I'll see what I can do on my own...


I have added shareRatio() and seedTime() functions, and for consistency I have renamed getMaxShareRatio() and getMaxSeedTime() into maxShareRatio() and maxSeedTime().


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]