forked from premiere/premiere-libtorrent
update simple_client.py
This commit is contained in:
parent
f8862302cc
commit
5ca35b8ef3
|
@ -13,12 +13,20 @@ ses.listen_on(6881, 6891)
|
||||||
e = lt.bdecode(open("test.torrent", 'rb').read())
|
e = lt.bdecode(open("test.torrent", 'rb').read())
|
||||||
info = lt.torrent_info(e)
|
info = lt.torrent_info(e)
|
||||||
|
|
||||||
h = ses.add_torrent(info, "./")
|
atp = {}
|
||||||
|
atp["ti"] = info
|
||||||
|
atp["save_path"] = "./"
|
||||||
|
atp["storage_mode"] = lt.storage_mode_t(1)
|
||||||
|
atp["paused"] = False
|
||||||
|
atp["auto_managed"] = True
|
||||||
|
atp["duplicate_is_error"] = True
|
||||||
|
|
||||||
|
h = ses.add_torrent(atp)
|
||||||
|
|
||||||
while (not h.is_seed()):
|
while (not h.is_seed()):
|
||||||
s = h.status()
|
s = h.status()
|
||||||
|
|
||||||
state_str = ['queued', 'checking', 'connecting', 'downloading metadata', \
|
state_str = ['queued', 'checking', 'downloading metadata', \
|
||||||
'downloading', 'finished', 'seeding', 'allocating']
|
'downloading', 'finished', 'seeding', 'allocating']
|
||||||
print '\r%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \
|
print '\r%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \
|
||||||
(s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, \
|
(s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, \
|
||||||
|
|
Loading…
Reference in New Issue