forked from premiere/premiere-libtorrent
merged python fix from RC_0_16
This commit is contained in:
parent
7909479505
commit
7974e50bb8
|
@ -5,6 +5,8 @@
|
||||||
* fix uTP edge case where udp socket buffer fills up
|
* fix uTP edge case where udp socket buffer fills up
|
||||||
* fix nagle implementation in uTP
|
* 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
|
* introduce a way to add built-in plugins from python
|
||||||
* consistently disconnect the same peer when two peers simultaneously connect
|
* consistently disconnect the same peer when two peers simultaneously connect
|
||||||
* fix local endpoint queries for uTP connections
|
* fix local endpoint queries for uTP connections
|
||||||
|
|
|
@ -219,22 +219,26 @@ def main():
|
||||||
alerts = []
|
alerts = []
|
||||||
|
|
||||||
for f in args:
|
for f in args:
|
||||||
e = lt.bdecode(open(f, 'rb').read())
|
|
||||||
info = lt.torrent_info(e)
|
|
||||||
print('Adding \'%s\'...' % info.name())
|
|
||||||
|
|
||||||
atp = {}
|
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["save_path"] = options.save_path
|
||||||
atp["storage_mode"] = lt.storage_mode_t.storage_mode_sparse
|
atp["storage_mode"] = lt.storage_mode_t.storage_mode_sparse
|
||||||
atp["paused"] = False
|
atp["paused"] = False
|
||||||
atp["auto_managed"] = True
|
atp["auto_managed"] = True
|
||||||
atp["duplicate_is_error"] = 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)
|
h = ses.add_torrent(atp)
|
||||||
|
|
||||||
|
@ -293,14 +297,18 @@ def main():
|
||||||
print_peer_info(console, h.get_peer_info())
|
print_peer_info(console, h.get_peer_info())
|
||||||
print_download_queue(console, h.get_download_queue())
|
print_download_queue(console, h.get_download_queue())
|
||||||
|
|
||||||
if True and s.state != lt.torrent_status.seeding:
|
if s.state != lt.torrent_status.seeding:
|
||||||
out = '\n'
|
try:
|
||||||
fp = h.file_progress()
|
out = '\n'
|
||||||
ti = h.get_torrent_info()
|
fp = h.file_progress()
|
||||||
for f,p in zip(ti.files(), fp):
|
fp = 0
|
||||||
out += progress_bar(p / f.size, 20)
|
ti = h.get_torrent_info()
|
||||||
out += ' ' + f.path + '\n'
|
for f,p in zip(ti.files(), fp):
|
||||||
write_line(console, out)
|
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, 76 * '-' + '\n')
|
||||||
write_line(console, '(q)uit), (p)ause), (u)npause), (r)eannounce\n')
|
write_line(console, '(q)uit), (p)ause), (u)npause), (r)eannounce\n')
|
||||||
|
|
|
@ -187,7 +187,7 @@ namespace
|
||||||
if (params.has_key("storage_mode"))
|
if (params.has_key("storage_mode"))
|
||||||
p.storage_mode = extract<storage_mode_t>(params["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"]);
|
list l = extract<list>(params["trackers"]);
|
||||||
int n = boost::python::len(l);
|
int n = boost::python::len(l);
|
||||||
|
|
Loading…
Reference in New Issue