Ejemplo n.º 1
0
 def getTorrentListByState(self, stateName):
     torrentInfoList = self.getTorrentList()
     resultTorrentInfoList = TorrentList()
     for torrentInfo in torrentInfoList:
         if torrentInfo.state == stateName:
             resultTorrentInfoList.append(torrentInfo)
     return resultTorrentInfoList
Ejemplo n.º 2
0
 def getTorrentListByLabel(self, labelName):
     torrentInfoList = self.getTorrentList()
     resultTorrentInfoList = TorrentList()
     for torrentInfo in torrentInfoList:
         if torrentInfo.label == labelName:
             resultTorrentInfoList.append(torrentInfo)
     return resultTorrentInfoList
Ejemplo n.º 3
0
 def getTorrentListByLabel(self, labelName):
     torrentInfoList = self.getTorrentList()
     resultTorrentInfoList = TorrentList()
     for torrentInfo in torrentInfoList:
         if torrentInfo.label == labelName:
             resultTorrentInfoList.append(torrentInfo)
     return resultTorrentInfoList
Ejemplo n.º 4
0
 def getTorrentListByState(self, stateName):
     torrentInfoList = self.getTorrentList()
     resultTorrentInfoList = TorrentList()
     for torrentInfo in torrentInfoList:
         if torrentInfo.state == stateName:
             resultTorrentInfoList.append(torrentInfo)
     return resultTorrentInfoList
Ejemplo n.º 5
0
 def getTorrentList(self):
     torrentList = TorrentList()
     jsonRes = self.updateUi()
     jdata = json.loads(jsonRes)
     for torrentId in jdata['result']['torrents']:
         torrentInfo = TorrentInfo()
         jsonTorrentInfo = jdata['result']['torrents'][torrentId]
         torrentInfo.torrentId = torrentId
         torrentInfo.state = jsonTorrentInfo['state']
         torrentInfo.name = jsonTorrentInfo['name'].encode('utf8')
         torrentInfo.progress = int(jsonTorrentInfo['progress'])
         torrentInfo.totalSize = int(jsonTorrentInfo['total_size'])
         torrentInfo.uploadPayloadRate = round(float(jsonTorrentInfo['upload_payload_rate']) / (1024), 2)
         torrentInfo.downloadPayloadRate = round(float(jsonTorrentInfo['download_payload_rate']) / (1024), 2)
         torrentInfo.eta = int(jsonTorrentInfo['eta'])
         torrentInfo.label = jsonTorrentInfo['label']
         torrentList.append(torrentInfo)
     return torrentList