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

Find the group of a torrent in scripting

Tags: None
(comma "," separated)
imported4-ossipon
Registered Member
Posts
1
Karma
0
Hello!

I’m writing a script that is supposed to handle torrents differently depending on the group they are in. However, I can’t find any functions in the api on the wiki that connect torrents to groups.
So I’m looking for either a function that lists the groups a torrent belong to, or a function that lists the torrents in a specific group. Any help would be highly appreciated :)
George
Moderator
Posts
5421
Karma
1
At the moment this functionality does not exist yet.
imported4-Sam
Registered Member
Posts
22
Karma
0
ossipon,

Bit of pita, but you can use the directory the torrent is in to 'emulate' a group and do actions on it.


Here's part of a snippet to delete something...


Code: Select all
PathToDelete = "deletewhenseeded"

import KTorrent
import KTScriptingPlugin
import Kross
import inspect
import datetime
import sys, os

ScriptName, extension = os.path.splitext(inspect.getfile( inspect.currentframe() ))
myName = inspect.stack()[0][3] # assign it something or python gets grumpy


   def checkAutoDelete(self,tor,cameFrom):
      rightNow = datetime.datetime.now().strftime("%m-%d %H:%M:%S")
      myName = inspect.stack()[0][3]
      if ( PathToDelete in tor.dataDir() ) and ( ( UseRatioToDelete == 1 and tor.shareRatio() > RatioToDelete ) or ( UseSeedTimeToDelete == 1 and tor.seedTime() > SeedTimeToDelete ) ):
         KTorrent.removeDelayed(tor.infoHash(),True)
         logfile = open(logfileName, 'a')
         logfile.write("%s :%s::%s::%s: - Del Tor:%s, DD:%s, SR: %.2f, ST: %.2f, Size: %sM \n" % ( rightNow, ScriptName, cameFrom, myName, tor.name(), tor.dataDir(), tor.shareRatio(), tor.seedTime(), (tor.totalSize()/1000000) ))
         logfile.close()


   def torrentFinished(self,tor):
      myName = inspect.stack()[0][3]
      self.changePriority(tor,myName)
      self.checkAutoDelete(tor,myName)



Bookmarks



Who is online

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