diff --git a/bindings/python/client.py b/bindings/python/client.py index 1e04a9a08..bf33528ae 100755 --- a/bindings/python/client.py +++ b/bindings/python/client.py @@ -244,7 +244,7 @@ def main(): resume_data = None h = ses.add_torrent(info, options.save_path, - resume_data=resume_data, compact_mode=compact_allocation) + resume_data, lt.storage_mode_t.storage_mode_sparse) handles.append(h) @@ -266,7 +266,7 @@ def main(): for h in handles: if h.has_metadata(): - name = h.torrent_info().name()[:40] + name = h.get_torrent_info().name()[:40] else: name = '-' out += 'name: %-40s\n' % name @@ -306,7 +306,7 @@ def main(): if True and s.state != lt.torrent_status.seeding: out = '\n' fp = h.file_progress() - ti = h.torrent_info() + ti = h.get_torrent_info() for f,p in zip(ti.files(), fp): out += progress_bar(p, 20) out += ' ' + f.path + '\n' @@ -349,7 +349,7 @@ def main(): continue h.pause() data = lt.bencode(h.write_resume_data()) - open(os.path.join(options.save_path, h.torrent_info().name() + '.fastresume'), 'wb').write(data) + open(os.path.join(options.save_path, h.get_torrent_info().name() + '.fastresume'), 'wb').write(data) main() diff --git a/bindings/python/simple_client.py b/bindings/python/simple_client.py index 78b47dbfb..9727bfbc2 100755 --- a/bindings/python/simple_client.py +++ b/bindings/python/simple_client.py @@ -13,16 +13,16 @@ ses.listen_on(6881, 6891) e = lt.bdecode(open("test.torrent", 'rb').read()) info = lt.torrent_info(e) -h = ses.add_torrent(info, "./", compact_mode = True) +h = ses.add_torrent(info, "./") while (not h.is_seed()): s = h.status() state_str = ['queued', 'checking', 'connecting', 'downloading metadata', \ 'downloading', 'finished', 'seeding', 'allocating'] - print '%.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.num_peers, state_str[s.state]) + s.num_peers, state_str[s.state]), time.sleep(1) diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index 343ef27bb..de9ba014c 100644 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include "gil.hpp" @@ -170,6 +171,8 @@ void replace_trackers(torrent_handle& info, object trackers) list get_download_queue(torrent_handle& handle) { + using boost::python::make_tuple; + list ret; std::vector downloading; @@ -193,7 +196,7 @@ list get_download_queue(torrent_handle& handle) block_info["num_peers"] = i->blocks[k].num_peers; block_info["bytes_progress"] = i->blocks[k].bytes_progress; block_info["block_size"] = i->blocks[k].block_size; - block_info["peer"] = std::make_pair( + block_info["peer"] = make_tuple( boost::lexical_cast(i->blocks[k].peer.address()), i->blocks[k].peer.port()); block_list.append(block_info); }