Nimrod
Nimrod

Reputation: 389

python-libtorrent torrent_info method

I've been using python-libtorrent to check what pieces belong to a file in a torrent containing multiple files.

I'm using the below code to iterate over the torrent file

info = libtorrent.torrent_info('~/.torrent')
for f in info.files():
    print f

But this returns <libtorrent.file_entry object at 0x7f0eda4fdcf0> and I don't know how to extract information from this.

I'm unaware of the torrent_info property which would return piece value information of various files. Some help is appreciated.

Upvotes: 0

Views: 597

Answers (2)

ev3jk
ev3jk

Reputation: 1

info = libtorrent.torrent_info('~/.torrent')
for f in info.files():
    # print f  
    print (f.path) 

You will get the important message...

Upvotes: 0

Arvid
Arvid

Reputation: 11245

the API is documented here and here. Obviously the python API can't always be exactly as the C++ one. But generally the interface takes a file index and returns some property of that file.

Upvotes: 1

Related Questions