![]() Registered Member ![]()
|
hwo do you add a torrent to a group, i've looked around but I don't know much so have missed any obvious documentation
Reading tracker_groups.py
It seams that calling self.tracker_map[tracker].ref() where tracker is KTorrent.torrent(info_hash).trackers(i) is doing the work but i don't get how? thx |
![]() Moderator ![]()
|
The isMember function of TrackerGroup is called to determine if a torrent is a member of a group :
http://ktorrent.org/wiki/index.php/Writing_Scripts#The_KTScriptingPlugin_Module |
![]() Registered Member ![]()
|
Sorry I still don't get it, I'm still learning python and havent really used classes yet, but how would i put a torrent into a group. would i just call it with true?
Ktorrent.group(groupname).ismember(True) or would i have to define a the Class (a link to explain classes to a noob would be nice) for my group 1st? so far the relevant code looks like
where tortype is just a string with video/film/album/discography/series/etc |
![]() Moderator ![]()
|
You don't call isMember, KT calls isMember. All you need to do is implement isMember. |
![]() Registered Member ![]()
|
So far i've managed this
I think i've got the isMember stuff right, but for some reason adding keeps failing, it seams to work fine when i try it in a python interpreter (without any KTorrent stuff as i don't know how to import Ktorrent module). What am i doing wrong now? |
![]() Moderator ![]()
|
The parameter t of isMember, is a torrent and you are storing info hashes in the members list. So for this to work you need to do this :
|
![]() Registered Member ![]()
|
Thanks, that has it working
![]() 1) KTorrent.log(self.members) still logs an empty line, which is confusing as your new isMembers function gets the groups populated :S 2) how can i read info on the torrent class? (e.g help(t) when using a normal python interpretor) i know its documented here but is it possible to load KTorrent & Kross into a normal python interpreter as that would probably make it easier to spot the mistakes im making p.s thx |
![]() Moderator ![]()
|
KTorrent.log takes a string as argument, so try converting that to a string : KTorrent.log(str(self.members))
Don't think this is possible. |
![]() Registered Member ![]()
|
can i call KTorrent.group(grpname) on my KTScriptingPlugin.addGroup(name,icon,path,obj) created groups?
and if so what do i pass as grpname (ive tried both obj and name (although i may have called it wrong)) here is my code (atm calling the dict[name]
|
![]() Moderator ![]()
|
No this is not possible, there are two kinds of groups :
- Default groups (don't have a group policy, the group itself determines which torrents are part of it) - Custom groups (have a group policy, are created by the user and the torrents are added by the user) KTScriptingPlugin.addGroup creates a default group, while KTorrent.group returns a custom group. I think this is certainly something which should change in the API. It's a bit confusing, and the old distinction between default and custom groups is a bit outdated. I'm gonna change this for 3.3. |
![]() Registered Member ![]()
|
I figure that the logic behind defauldownlaod dirs and speed limits gets complicated when a torrent can be in multiple groups at once, I added a note to the wiki so other noobs don't get confused by the same thing.
|
Registered users: Bing [Bot], Evergrowing, Google [Bot]