From c35553d4a8989cc509ffe6a5c17746ea453e8eba Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 29 Mar 2008 04:36:30 +0000 Subject: [PATCH] Update libtorrent python bindings to lt rev 2120. --- libtorrent/bindings/python/src/docstrings.cpp | 1 + libtorrent/bindings/python/src/ip_filter.cpp | 1 + libtorrent/bindings/python/src/peer_info.cpp | 69 +++- libtorrent/bindings/python/src/session.cpp | 19 +- .../bindings/python/src/session_settings.cpp | 2 + .../bindings/python/src/torrent_handle.cpp | 323 ++++++++++-------- .../bindings/python/src/torrent_info.cpp | 11 +- .../bindings/python/src/torrent_status.cpp | 64 ++-- 8 files changed, 290 insertions(+), 200 deletions(-) diff --git a/libtorrent/bindings/python/src/docstrings.cpp b/libtorrent/bindings/python/src/docstrings.cpp index 647e375cd..87d7e89c7 100755 --- a/libtorrent/bindings/python/src/docstrings.cpp +++ b/libtorrent/bindings/python/src/docstrings.cpp @@ -181,6 +181,7 @@ char const* session_stop_natpmp_doc = ""; char const* session_set_ip_filter_doc = ""; + // -- alert ----------------------------------------------------------------- char const* alert_doc = diff --git a/libtorrent/bindings/python/src/ip_filter.cpp b/libtorrent/bindings/python/src/ip_filter.cpp index d8e6808a4..eed216141 100644 --- a/libtorrent/bindings/python/src/ip_filter.cpp +++ b/libtorrent/bindings/python/src/ip_filter.cpp @@ -25,3 +25,4 @@ void bind_ip_filter() .def_readonly("export_filter", allow_threads(&ip_filter::export_filter)) ; } + diff --git a/libtorrent/bindings/python/src/peer_info.cpp b/libtorrent/bindings/python/src/peer_info.cpp index 49570b795..f11096677 100755 --- a/libtorrent/bindings/python/src/peer_info.cpp +++ b/libtorrent/bindings/python/src/peer_info.cpp @@ -4,15 +4,51 @@ #include #include +#include using namespace boost::python; using namespace libtorrent; +int get_last_active(peer_info const& pi) +{ + return total_seconds(pi.last_active); +} + +int get_last_request(peer_info const& pi) +{ + return total_seconds(pi.last_request); +} + +#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES +str get_country(peer_info const& pi) +{ + return str(pi.country, 2); +} +#endif + +tuple get_ip(peer_info const& pi) +{ + return make_tuple(boost::lexical_cast(pi.ip.address()), pi.ip.port()); +} + +list get_pieces(peer_info const& pi) +{ + list ret; + + for (std::vector::const_iterator i = pi.pieces.begin() + , end(pi.pieces.end()); i != end; ++i) + { + ret.append(*i); + } + return ret; +} + void bind_peer_info() { scope pi = class_("peer_info") .def_readonly("flags", &peer_info::flags) - .def_readonly("ip", &peer_info::ip) + .def_readonly("source", &peer_info::source) + .add_property("ip", get_ip) .def_readonly("up_speed", &peer_info::up_speed) .def_readonly("down_speed", &peer_info::down_speed) .def_readonly("payload_up_speed", &peer_info::payload_up_speed) @@ -20,21 +56,32 @@ void bind_peer_info() .def_readonly("total_download", &peer_info::total_download) .def_readonly("total_upload", &peer_info::total_upload) .def_readonly("pid", &peer_info::pid) - .def_readonly("pieces", &peer_info::pieces) + .add_property("pieces", get_pieces) .def_readonly("upload_limit", &peer_info::upload_limit) .def_readonly("download_limit", &peer_info::download_limit) + .add_property("last_request", get_last_request) + .add_property("last_active", get_last_active) + .def_readonly("send_buffer_size", &peer_info::send_buffer_size) + .def_readonly("used_send_buffer", &peer_info::used_send_buffer) + .def_readonly("num_hashfails", &peer_info::num_hashfails) +#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES + .add_property("country", get_country) +#endif .def_readonly("load_balancing", &peer_info::load_balancing) .def_readonly("download_queue_length", &peer_info::download_queue_length) .def_readonly("upload_queue_length", &peer_info::upload_queue_length) + .def_readonly("failcount", &peer_info::failcount) .def_readonly("downloading_piece_index", &peer_info::downloading_piece_index) .def_readonly("downloading_block_index", &peer_info::downloading_block_index) .def_readonly("downloading_progress", &peer_info::downloading_progress) .def_readonly("downloading_total", &peer_info::downloading_total) .def_readonly("client", &peer_info::client) .def_readonly("connection_type", &peer_info::connection_type) - .def_readonly("source", &peer_info::source) + .def_readonly("remote_dl_rate", &peer_info::remote_dl_rate) + .def_readonly("pending_disk_bytes", &peer_info::pending_disk_bytes) ; + // flags pi.attr("interesting") = (int)peer_info::interesting; pi.attr("choked") = (int)peer_info::choked; pi.attr("remote_interested") = (int)peer_info::remote_interested; @@ -51,13 +98,15 @@ void bind_peer_info() pi.attr("plaintext_encrypted") = (int)peer_info::plaintext_encrypted; #endif - pi.attr("standard_bittorrent") = 0; - pi.attr("web_seed") = 1; + // connection_type + pi.attr("standard_bittorrent") = (int)peer_info::standard_bittorrent; + pi.attr("web_seed") = (int)peer_info::web_seed; - pi.attr("tracker") = 0x1; - pi.attr("dht") = 0x2; - pi.attr("pex") = 0x4; - pi.attr("lsd") = 0x8; - pi.attr("resume_data") = 0x10; + // source + pi.attr("tracker") = (int)peer_info::tracker; + pi.attr("dht") = (int)peer_info::dht; + pi.attr("pex") = (int)peer_info::pex; + pi.attr("lsd") = (int)peer_info::lsd; + pi.attr("resume_data") = (int)peer_info::resume_data; } diff --git a/libtorrent/bindings/python/src/session.cpp b/libtorrent/bindings/python/src/session.cpp index dbaee26b6..3b4a891c0 100755 --- a/libtorrent/bindings/python/src/session.cpp +++ b/libtorrent/bindings/python/src/session.cpp @@ -69,11 +69,13 @@ namespace return s.listen_on(std::make_pair(min_, max_), interface); } +#ifndef TORRENT_DISABLE_DHT void add_dht_router(session& s, std::string router_, int port_) { allow_threading_guard guard; return s.add_dht_router(std::make_pair(router_, port_)); } +#endif struct invoke_extension_factory { @@ -185,18 +187,19 @@ void bind_session() , (arg("min"), "max", arg("interface") = (char const*)0) , session_listen_on_doc ) + .def("is_listening", allow_threads(&session::is_listening), session_is_listening_doc) + .def("listen_port", allow_threads(&session::listen_port), session_listen_port_doc) + .def("status", allow_threads(&session::status), session_status_m_doc) +#ifndef TORRENT_DISABLE_DHT .def( "add_dht_router", &add_dht_router , (arg("router"), "port") , session_add_dht_router_doc ) - .def("is_listening", allow_threads(&session::is_listening), session_is_listening_doc) - .def("listen_port", allow_threads(&session::listen_port), session_listen_port_doc) - .def("status", allow_threads(&session::status), session_status_m_doc) -#ifndef TORRENT_DISABLE_DHT .def("start_dht", allow_threads(&session::start_dht), session_start_dht_doc) .def("stop_dht", allow_threads(&session::stop_dht), session_stop_dht_doc) .def("dht_state", allow_threads(&session::dht_state), session_dht_state_doc) + .def("set_dht_proxy", allow_threads(&session::set_dht_proxy)) #endif .def( "add_torrent", &add_torrent @@ -206,7 +209,8 @@ void bind_session() ) , session_add_torrent_doc ) - .def("remove_torrent", allow_threads(&session::remove_torrent), session_remove_torrent_doc) + .def("remove_torrent", allow_threads(&session::remove_torrent), arg("option") = session::none + , session_remove_torrent_doc) .def( "set_download_rate_limit", allow_threads(&session::set_download_rate_limit) , session_set_download_rate_limit_doc @@ -242,8 +246,10 @@ void bind_session() , session_num_connections_doc ) .def("set_settings", allow_threads(&session::set_settings), session_set_settings_doc) +#ifndef TORRENT_DISABLE_ENCRYPTION .def("set_pe_settings", allow_threads(&session::set_pe_settings), session_set_pe_settings_doc) .def("get_pe_settings", allow_threads(&session::get_pe_settings), return_value_policy()) +#endif .def( "set_severity_level", allow_threads(&session::set_severity_level) , session_set_severity_level_doc @@ -253,9 +259,6 @@ void bind_session() .def("set_peer_proxy", allow_threads(&session::set_peer_proxy)) .def("set_tracker_proxy", allow_threads(&session::set_tracker_proxy)) .def("set_web_seed_proxy", allow_threads(&session::set_web_seed_proxy)) -#ifndef TORRENT_DISABLE_DHT - .def("set_dht_proxy", allow_threads(&session::set_dht_proxy)) -#endif .def("start_upnp", allow_threads(&session::start_upnp), session_start_upnp_doc) .def("stop_upnp", allow_threads(&session::stop_upnp), session_stop_upnp_doc) .def("start_lsd", allow_threads(&session::start_lsd), session_start_lsd_doc) diff --git a/libtorrent/bindings/python/src/session_settings.cpp b/libtorrent/bindings/python/src/session_settings.cpp index f893f560c..0d8a8be02 100755 --- a/libtorrent/bindings/python/src/session_settings.cpp +++ b/libtorrent/bindings/python/src/session_settings.cpp @@ -55,6 +55,7 @@ void bind_session_settings() .def_readwrite("type", &proxy_settings::type) ; +#ifndef TORRENT_DISABLE_ENCRYPTION enum_("enc_policy") .value("forced", pe_settings::forced) .value("enabled", pe_settings::enabled) @@ -73,6 +74,7 @@ void bind_session_settings() .def_readwrite("allowed_enc_level", &pe_settings::allowed_enc_level) .def_readwrite("prefer_rc4", &pe_settings::prefer_rc4) ; +#endif } diff --git a/libtorrent/bindings/python/src/torrent_handle.cpp b/libtorrent/bindings/python/src/torrent_handle.cpp index 6e66ce930..165bea304 100755 --- a/libtorrent/bindings/python/src/torrent_handle.cpp +++ b/libtorrent/bindings/python/src/torrent_handle.cpp @@ -4,6 +4,7 @@ #include #include +#include #include "gil.hpp" using namespace boost::python; @@ -12,13 +13,57 @@ using namespace libtorrent; namespace { + list url_seeds(torrent_handle& handle) + { + list ret; + std::set urls; + { + allow_threading_guard guard; + urls = handle.url_seeds(); + } + + for (std::set::iterator i(urls.begin()) + , end(urls.end()); i != end; ++i) + ret.append(*i); + return ret; + } + + list piece_availability(torrent_handle& handle) + { + list ret; + std::vector avail; + { + allow_threading_guard guard; + handle.piece_availability(avail); + } + + for (std::vector::iterator i(avail.begin()) + , end(avail.end()); i != end; ++i) + ret.append(*i); + return ret; + } + + list piece_priorities(torrent_handle& handle) + { + list ret; + std::vector prio; + { + allow_threading_guard guard; + prio = handle.piece_priorities(); + } + + for (std::vector::iterator i(prio.begin()) + , end(prio.end()); i != end; ++i) + ret.append(*i); + return ret; + } + std::vector::const_iterator begin_trackers(torrent_handle& i) { allow_threading_guard guard; return i.trackers().begin(); } - std::vector::const_iterator end_trackers(torrent_handle& i) { allow_threading_guard guard; @@ -57,87 +102,49 @@ list get_peer_info(torrent_handle const& handle) list result; for (std::vector::iterator i = pi.begin(); i != pi.end(); ++i) - { - dict peer; - peer["flags"] = i->flags; - peer["ip"] = i->ip.address().to_string(); - peer["up_speed"] = i->up_speed; - peer["down_speed"] = i->down_speed; - peer["payload_up_speed"] = i->payload_up_speed; - peer["payload_down_speed"] = i->payload_down_speed; - peer["total_download"] = i->total_download; - peer["total_upload"] = i->total_upload; - peer["pid"] = i->pid; - list pieces; - for (std::vector::const_iterator p = i->pieces.begin(); p != i->pieces.end(); ++p) - pieces.append(*p); - - peer["pieces"] = pieces; - peer["upload_limit"] = i->upload_limit; - peer["download_limit"] = i->download_limit; - peer["load_balancing"] = i->load_balancing; - peer["download_queue_length"] = i->download_queue_length; - peer["upload_queue_length"] = i->upload_queue_length; - peer["downloading_piece_index"] = i->downloading_piece_index; - peer["downloading_block_index"] = i->downloading_block_index; - peer["downloading_progess"] = i->downloading_progress; - peer["downloading_total"] = i->downloading_total; - peer["client"] = i->client; - peer["connection_type"] = i->connection_type; - peer["source"] = i->source; - peer["country"] = i->country; - peer["interesting"] = (int)i->interesting; - peer["choked"] = (int)i->choked; - peer["remote_interested"] = (int)i->remote_interested; - peer["remote_choked"] = (int)i->remote_choked; - peer["supports_extensions"] = (int)i->supports_extensions; - peer["local_connection"] = (int)i->local_connection; - peer["handshake"] = (int)i->handshake; - peer["connecting"] = (int)i->connecting; - peer["queued"] = (int)i->queued; - peer["on_parole"] = (int)i->on_parole; - peer["seed"] = (int)i->seed; -#ifndef TORRENT_DISABLE_ENCRYPTION - peer["rc4_encrypted"] = (int)i->rc4_encrypted; - peer["plaintext_encrypted"] = (int)i->plaintext_encrypted; -#endif - - peer["standard_bittorrent"] = 0; - peer["web_seed"] = 1; - - peer["tracker"] = 0x1; - peer["dht"] = 0x2; - peer["pex"] = 0x4; - peer["lsd"] = 0x8; - peer["resume_data"] = 0x10; - - result.append(peer); - } + result.append(*i); return result; } +void prioritize_pieces(torrent_handle& info, object o) +{ + std::vector result; + try + { + object iter_obj = object( handle<>( PyObject_GetIter( o.ptr() ) )); + while( 1 ) + { + object obj = extract( iter_obj.attr( "next" )() ); + result.push_back(extract( obj )); + } + } + catch( error_already_set ) + { + PyErr_Clear(); + info.prioritize_pieces(result); + return; + } +} void prioritize_files(torrent_handle& info, object o) { - - std::vector result; - try - { - object iter_obj = object( handle<>( PyObject_GetIter( o.ptr() ) )); - while( 1 ) - { - object obj = extract( iter_obj.attr( "next" )() ); - result.push_back(extract( obj )); - } - } - catch( error_already_set ) - { - PyErr_Clear(); - info.prioritize_files(result); - return; - } - + std::vector result; + try + { + object iter_obj = object( handle<>( PyObject_GetIter( o.ptr() ) )); + while( 1 ) + { + object obj = extract( iter_obj.attr( "next" )() ); + result.push_back(extract( obj )); + } + } + catch( error_already_set ) + { + PyErr_Clear(); + info.prioritize_files(result); + return; + } } @@ -163,87 +170,137 @@ void replace_trackers(torrent_handle& info, object trackers) list get_download_queue(torrent_handle& handle) { - list ret; + list ret; - std::vector downloading; + std::vector downloading; - { - allow_threading_guard guard; - handle.get_download_queue(downloading); - } + { + allow_threading_guard guard; + handle.get_download_queue(downloading); + } - for (std::vector::iterator i = downloading.begin() - , end(downloading.end()); i != end; ++i) - { - dict partial_piece; - partial_piece["piece_index"] = i->piece_index; - partial_piece["blocks_in_piece"] = i->blocks_in_piece; - list block_list; - for (int k = 0; k < i->blocks_in_piece; ++k) - { - dict block_info; - block_info["state"] = i->blocks[k].state; - 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"] = i->info[k].peer; - block_list.append(block_info); - } - partial_piece["blocks"] = block_list; + for (std::vector::iterator i = downloading.begin() + , end(downloading.end()); i != end; ++i) + { + dict partial_piece; + partial_piece["piece_index"] = i->piece_index; + partial_piece["blocks_in_piece"] = i->blocks_in_piece; + list block_list; + for (int k = 0; k < i->blocks_in_piece; ++k) + { + dict block_info; + block_info["state"] = i->blocks[k].state; + 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( + boost::lexical_cast(i->blocks[k].peer.address()), i->blocks[k].peer.port()); + block_list.append(block_info); + } + partial_piece["blocks"] = block_list; - ret.append(partial_piece); - } + ret.append(partial_piece); + } - return ret; + return ret; +} + +namespace +{ + tcp::endpoint tuple_to_endpoint(tuple const& t) + { + return tcp::endpoint(address::from_string(extract(t[0])), extract(t[1])); + } +} + +void force_reannounce(torrent_handle& th, int s) +{ + th.force_reannounce(boost::posix_time::seconds(s)); +} + +void connect_peer(torrent_handle& th, tuple ip, int source) +{ + th.connect_peer(tuple_to_endpoint(ip), source); +} + +void set_peer_upload_limit(torrent_handle& th, tuple const& ip, int limit) +{ + th.set_peer_upload_limit(tuple_to_endpoint(ip), limit); +} + +void set_peer_download_limit(torrent_handle& th, tuple const& ip, int limit) +{ + th.set_peer_download_limit(tuple_to_endpoint(ip), limit); } void bind_torrent_handle() { void (torrent_handle::*force_reannounce0)() const = &torrent_handle::force_reannounce; - void (torrent_handle::*force_reannounce1)(boost::posix_time::time_duration) const - = &torrent_handle::force_reannounce; int (torrent_handle::*piece_priority0)(int) const = &torrent_handle::piece_priority; void (torrent_handle::*piece_priority1)(int, int) const = &torrent_handle::piece_priority; - + +#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES + bool (torrent_handle::*resolve_countries0)() const = &torrent_handle::resolve_countries; + void (torrent_handle::*resolve_countries1)(bool) = &torrent_handle::resolve_countries; +#endif + return_value_policy copy; #define _ allow_threads class_("torrent_handle") + .def("get_peer_info", get_peer_info) .def("status", _(&torrent_handle::status)) - .def("torrent_info", _(&torrent_handle::get_torrent_info), return_internal_reference<>()) - .def("is_valid", _(&torrent_handle::is_valid)) - .def("write_resume_data", _(&torrent_handle::write_resume_data)) - .def("force_reannounce", _(force_reannounce0)) - .def("force_reannounce", _(force_reannounce1)) - .def("set_tracker_login", _(&torrent_handle::set_tracker_login)) - .def("add_url_seed", _(&torrent_handle::add_url_seed)) - .def("set_ratio", _(&torrent_handle::set_ratio)) - .def("set_max_uploads", _(&torrent_handle::set_max_uploads)) - .def("set_max_connections", _(&torrent_handle::set_max_connections)) - .def("set_upload_limit", _(&torrent_handle::set_upload_limit)) - .def("set_download_limit", _(&torrent_handle::set_download_limit)) - .def("set_sequenced_download_threshold", _(&torrent_handle::set_sequenced_download_threshold)) - .def("pause", _(&torrent_handle::pause)) - .def("resume", _(&torrent_handle::resume)) - .def("is_paused", _(&torrent_handle::is_paused)) - .def("is_seed", _(&torrent_handle::is_seed)) - .def("filter_piece", _(&torrent_handle::filter_piece)) - .def("piece_priority", _(piece_priority0)) - .def("piece_priority", _(piece_priority1)) - .def("is_piece_filtered", _(&torrent_handle::is_piece_filtered)) - .def("has_metadata", _(&torrent_handle::has_metadata)) - .def("save_path", _(&torrent_handle::save_path)) - .def("move_storage", _(&torrent_handle::move_storage)) - .def("info_hash", _(&torrent_handle::info_hash), copy) + .def("get_download_queue", get_download_queue) .def("file_progress", file_progress) .def("trackers", range(begin_trackers, end_trackers)) .def("replace_trackers", replace_trackers) + .def("add_url_seed", _(&torrent_handle::add_url_seed)) + .def("remove_url_seed", _(&torrent_handle::remove_url_seed)) + .def("url_seeds", url_seeds) + .def("has_metadata", _(&torrent_handle::has_metadata)) + .def("get_torrent_info", _(&torrent_handle::get_torrent_info), return_internal_reference<>()) + .def("is_valid", _(&torrent_handle::is_valid)) + .def("is_seed", _(&torrent_handle::is_seed)) + .def("is_paused", _(&torrent_handle::is_paused)) + .def("pause", _(&torrent_handle::pause)) + .def("resume", _(&torrent_handle::resume)) +#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES + .def("resolve_countries", _(resolve_countries0)) + .def("resolve_countries", _(resolve_countries1)) +#endif + // deprecated + .def("filter_piece", _(&torrent_handle::filter_piece)) + .def("is_piece_filtered", _(&torrent_handle::is_piece_filtered)) + + .def("piece_availability", piece_availability) + .def("piece_priority", _(piece_priority0)) + .def("piece_priority", _(piece_priority1)) + .def("prioritize_pieces", prioritize_pieces) + .def("piece_prioritize", piece_priorities) .def("prioritize_files", prioritize_files) - .def("get_peer_info", get_peer_info) - .def("get_download_queue", get_download_queue) - .def("scrape_tracker", (&torrent_handle::scrape_tracker)) + .def("use_interface", &torrent_handle::use_interface) + .def("write_resume_data", _(&torrent_handle::write_resume_data)) + .def("force_reannounce", _(force_reannounce0)) + .def("force_reannounce", force_reannounce) + .def("scrape_tracker", _(&torrent_handle::scrape_tracker)) + .def("name", _(&torrent_handle::name)) + .def("set_upload_limit", _(&torrent_handle::set_upload_limit)) + .def("upload_limit", _(&torrent_handle::upload_limit)) + .def("set_download_limit", _(&torrent_handle::set_download_limit)) + .def("download_limit", _(&torrent_handle::download_limit)) + .def("set_sequenced_download_threshold", _(&torrent_handle::set_sequenced_download_threshold)) + .def("set_peer_upload_limit", set_peer_upload_limit) + .def("set_peer_download_limit", set_peer_download_limit) + .def("connect_peer", connect_peer) + .def("set_ratio", _(&torrent_handle::set_ratio)) + .def("save_path", _(&torrent_handle::save_path)) + .def("set_max_uploads", _(&torrent_handle::set_max_uploads)) + .def("set_max_connections", _(&torrent_handle::set_max_connections)) + .def("set_tracker_login", _(&torrent_handle::set_tracker_login)) + .def("move_storage", _(&torrent_handle::move_storage)) + .def("info_hash", _(&torrent_handle::info_hash), copy) ; } diff --git a/libtorrent/bindings/python/src/torrent_info.cpp b/libtorrent/bindings/python/src/torrent_info.cpp index 359ab5449..a24ebd181 100755 --- a/libtorrent/bindings/python/src/torrent_info.cpp +++ b/libtorrent/bindings/python/src/torrent_info.cpp @@ -44,12 +44,12 @@ namespace { return i.begin_files(storage); } - + std::vector::const_iterator end_files(torrent_info& i, bool storage) { return i.end_files(storage); } - + //list files(torrent_info const& ti, bool storage) { list files(torrent_info const& ti, bool storage) { list result; @@ -61,7 +61,7 @@ namespace return result; } - + } // namespace unnamed @@ -92,8 +92,8 @@ void bind_torrent_info() .def("hash_for_piece", &torrent_info::hash_for_piece, copy) .def("piece_size", &torrent_info::piece_size) - - .def("num_files", &torrent_info::num_files, (arg("storage")=false)) + + .def("num_files", &torrent_info::num_files, (arg("storage")=false)) .def("file_at", &torrent_info::file_at, return_internal_reference<>()) .def("files", &files, (arg("storage")=false)) @@ -106,6 +106,7 @@ void bind_torrent_info() .def("add_node", &add_node) .def("nodes", &nodes) ; + class_("file_entry") .add_property( "path" diff --git a/libtorrent/bindings/python/src/torrent_status.cpp b/libtorrent/bindings/python/src/torrent_status.cpp index c321f8bb2..3947e156b 100755 --- a/libtorrent/bindings/python/src/torrent_status.cpp +++ b/libtorrent/bindings/python/src/torrent_status.cpp @@ -18,79 +18,55 @@ object pieces(torrent_status const& s) return result; } -extern char const* torrent_status_doc; -extern char const* torrent_status_state_doc; -extern char const* torrent_status_paused_doc; -extern char const* torrent_status_progress_doc; -extern char const* torrent_status_next_announce_doc; -extern char const* torrent_status_announce_interval_doc; -extern char const* torrent_status_current_tracker_doc; -extern char const* torrent_status_total_download_doc; -extern char const* torrent_status_total_upload_doc; -extern char const* torrent_status_total_payload_download_doc; -extern char const* torrent_status_total_payload_upload_doc; -extern char const* torrent_status_total_failed_bytes_doc; - void bind_torrent_status() { - scope status = class_("torrent_status", torrent_status_doc) - .def_readonly("state", &torrent_status::state, torrent_status_state_doc) - .def_readonly("paused", &torrent_status::paused, torrent_status_paused_doc) - .def_readonly("progress", &torrent_status::progress, torrent_status_progress_doc) + scope status = class_("torrent_status") + .def_readonly("state", &torrent_status::state) + .def_readonly("paused", &torrent_status::paused) + .def_readonly("progress", &torrent_status::progress) .add_property( "next_announce" , make_getter( &torrent_status::next_announce, return_value_policy() ) - , torrent_status_next_announce_doc ) .add_property( "announce_interval" , make_getter( &torrent_status::announce_interval, return_value_policy() ) - , torrent_status_announce_interval_doc - ) - .def_readonly( - "current_tracker", &torrent_status::current_tracker - , torrent_status_current_tracker_doc - ) - .def_readonly( - "total_download", &torrent_status::total_download - , torrent_status_total_download_doc - ) - .def_readonly( - "total_upload", &torrent_status::total_upload - , torrent_status_total_upload_doc - ) - .def_readonly( - "total_payload_download", &torrent_status::total_payload_download - , torrent_status_total_payload_download_doc - ) - .def_readonly( - "total_payload_upload", &torrent_status::total_payload_upload - , torrent_status_total_payload_upload_doc - ) - .def_readonly( - "total_failed_bytes", &torrent_status::total_failed_bytes - , torrent_status_total_failed_bytes_doc ) + .def_readonly("current_tracker", &torrent_status::current_tracker) + .def_readonly("total_download", &torrent_status::total_download) + .def_readonly("total_upload", &torrent_status::total_upload) + .def_readonly("total_payload_download", &torrent_status::total_payload_download) + .def_readonly("total_payload_upload", &torrent_status::total_payload_upload) + .def_readonly("total_failed_bytes", &torrent_status::total_failed_bytes) .def_readonly("total_redundant_bytes", &torrent_status::total_redundant_bytes) .def_readonly("download_rate", &torrent_status::download_rate) .def_readonly("upload_rate", &torrent_status::upload_rate) .def_readonly("download_payload_rate", &torrent_status::download_payload_rate) .def_readonly("upload_payload_rate", &torrent_status::upload_payload_rate) + .def_readonly("num_seeds", &torrent_status::num_seeds) .def_readonly("num_peers", &torrent_status::num_peers) .def_readonly("num_complete", &torrent_status::num_complete) .def_readonly("num_incomplete", &torrent_status::num_incomplete) + .def_readonly("list_seeds", &torrent_status::list_seeds) + .def_readonly("list_peers", &torrent_status::list_peers) .add_property("pieces", pieces) .def_readonly("num_pieces", &torrent_status::num_pieces) .def_readonly("total_done", &torrent_status::total_done) .def_readonly("total_wanted_done", &torrent_status::total_wanted_done) .def_readonly("total_wanted", &torrent_status::total_wanted) - .def_readonly("num_seeds", &torrent_status::num_seeds) .def_readonly("distributed_copies", &torrent_status::distributed_copies) .def_readonly("block_size", &torrent_status::block_size) + .def_readonly("num_uploads", &torrent_status::num_uploads) + .def_readonly("num_connections", &torrent_status::num_connections) + .def_readonly("uploads_limit", &torrent_status::uploads_limit) + .def_readonly("connections_limit", &torrent_status::connections_limit) + .def_readonly("storage_mode", &torrent_status::storage_mode) + .def_readonly("up_bandwidth_queue", &torrent_status::up_bandwidth_queue) + .def_readonly("down_bandwidth_queue", &torrent_status::down_bandwidth_queue) ; enum_("states")