merged python fix from RC_0_16

This commit is contained in:
Arvid Norberg 2012-10-13 16:50:07 +00:00
parent 7909479505
commit 7974e50bb8
3 changed files with 28 additions and 18 deletions

View File

@ -5,6 +5,8 @@
* fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP
* add support for magnet links and URLs in python example client
* fixed typo in python bindings' add_torrent_params
* introduce a way to add built-in plugins from python
* consistently disconnect the same peer when two peers simultaneously connect
* fix local endpoint queries for uTP connections

View File

@ -219,22 +219,26 @@ def main():
alerts = []
for f in args:
e = lt.bdecode(open(f, 'rb').read())
info = lt.torrent_info(e)
print('Adding \'%s\'...' % info.name())
atp = {}
try:
atp["resume_data"] = open(os.path.join(options.save_path, info.name() + '.fastresume'), 'rb').read()
except:
pass
atp["ti"] = info
atp["save_path"] = options.save_path
atp["storage_mode"] = lt.storage_mode_t.storage_mode_sparse
atp["paused"] = False
atp["auto_managed"] = True
atp["duplicate_is_error"] = True
if f.startswith('magnet:') or f.startswith('http://') or f.startswith('https://'):
atp["url"] = f
else:
e = lt.bdecode(open(f, 'rb').read())
info = lt.torrent_info(e)
print('Adding \'%s\'...' % info.name())
try:
atp["resume_data"] = open(os.path.join(options.save_path, info.name() + '.fastresume'), 'rb').read()
except:
pass
atp["ti"] = info
h = ses.add_torrent(atp)
@ -293,14 +297,18 @@ def main():
print_peer_info(console, h.get_peer_info())
print_download_queue(console, h.get_download_queue())
if True and s.state != lt.torrent_status.seeding:
out = '\n'
fp = h.file_progress()
ti = h.get_torrent_info()
for f,p in zip(ti.files(), fp):
out += progress_bar(p / f.size, 20)
out += ' ' + f.path + '\n'
write_line(console, out)
if s.state != lt.torrent_status.seeding:
try:
out = '\n'
fp = h.file_progress()
fp = 0
ti = h.get_torrent_info()
for f,p in zip(ti.files(), fp):
out += progress_bar(p / f.size, 20)
out += ' ' + f.path + '\n'
write_line(console, out)
except:
pass
write_line(console, 76 * '-' + '\n')
write_line(console, '(q)uit), (p)ause), (u)npause), (r)eannounce\n')

View File

@ -187,7 +187,7 @@ namespace
if (params.has_key("storage_mode"))
p.storage_mode = extract<storage_mode_t>(params["storage_mode"]);
if (params.has_key("tracker_url"))
if (params.has_key("trackers"))
{
list l = extract<list>(params["trackers"]);
int n = boost::python::len(l);