the perfect way to get torrent size

Issue #44 resolved
created an issue

Hi, I managed to get the total size of torrent using this :

import transmissionrpc

tc = transmissionrpc.Client('localhost', port=9091)
torrent = tc.get_torrent(1)
Files = torrent.files()

tSize = 0
dicnum = 0

for i in range(len(Files)):
    size = Files[dirnum]['size']
    tSize += size
    dicnum += 1

Now the tSize variable will have the total size of torrent number 1, so is there better way to get torrent size other than that ? because i'm not that good with python.

Comments (4)

  1. pyed reporter

    Thanks Erik for replying and for making transmissionrpc

    I was reading rpc-spec.txt and I found what i need:

    torrent = tc.get_torrent(1)
  2. Log in to comment