fixes bug where priorities where lost when force-rechecking.
[libtorrent.git] / bindings / python / simple_client.py
blob9727bfbc24fe680eefad1288be0a42303d5e98c0
1 #!/bin/python
2 # Copyright Arvid Norberg 2008. Use, modification and distribution is
3 # subject to the Boost Software License, Version 1.0. (See accompanying
4 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 import libtorrent as lt
8 import time
10 ses = lt.session()
11 ses.listen_on(6881, 6891)
13 e = lt.bdecode(open("test.torrent", 'rb').read())
14 info = lt.torrent_info(e)
16 h = ses.add_torrent(info, "./")
18 while (not h.is_seed()):
19 s = h.status()
21 state_str = ['queued', 'checking', 'connecting', 'downloading metadata', \
22 'downloading', 'finished', 'seeding', 'allocating']
23 print '\r%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \
24 (s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, \
25 s.num_peers, state_str[s.state]),
27 time.sleep(1)