python bindings updates and build fixes

This commit is contained in:
Arvid Norberg 2010-09-05 16:49:03 +00:00
parent b6f92aa981
commit e3e70d3412
5 changed files with 37 additions and 10 deletions

View File

@ -111,6 +111,10 @@ namespace
p.duplicate_is_error = params["duplicate_is_error"];
if (params.has_key("seed_mode"))
p.seed_mode = params["seed_mode"];
if (params.has_key("upload_mode"))
p.upload_mode = params["upload_mode"];
if (params.has_key("share_mode"))
p.upload_mode = params["share_mode"];
if (params.has_key("override_resume_data"))
p.override_resume_data = params["override_resume_data"];
@ -305,7 +309,7 @@ void bind_session()
.def("dht_state", allow_threads(&session::dht_state))
#endif
.def("set_dht_proxy", allow_threads(&session::set_dht_proxy))
.def("dht_proxy", allow_threads(&session::dht_proxy), return_value_policy<copy_const_reference>())
.def("dht_proxy", allow_threads(&session::dht_proxy))
#endif
.def("add_torrent", &add_torrent)
#ifndef BOOST_NO_EXCEPTIONS
@ -339,10 +343,10 @@ void bind_session()
.def("set_max_half_open_connections", allow_threads(&session::set_max_half_open_connections))
.def("num_connections", allow_threads(&session::num_connections))
.def("set_settings", allow_threads(&session::set_settings))
.def("settings", allow_threads(&session::settings), return_value_policy<copy_const_reference>())
.def("settings", allow_threads(&session::settings))
#ifndef TORRENT_DISABLE_ENCRYPTION
.def("set_pe_settings", allow_threads(&session::set_pe_settings))
.def("get_pe_settings", allow_threads(&session::get_pe_settings), return_value_policy<copy_const_reference>())
.def("get_pe_settings", allow_threads(&session::get_pe_settings))
#endif
#ifndef TORRENT_DISABLE_GEO_IP
.def("load_asnum_db", &load_asnum_db)
@ -358,12 +362,16 @@ void bind_session()
.def("pop_alert", allow_threads(&session::pop_alert))
.def("wait_for_alert", &wait_for_alert, return_internal_reference<>())
.def("add_extension", &add_extension)
#ifndef TORRENT_NO_DEPRECATE
.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))
.def("peer_proxy", allow_threads(&session::peer_proxy), return_value_policy<copy_const_reference>())
.def("tracker_proxy", allow_threads(&session::tracker_proxy), return_value_policy<copy_const_reference>())
.def("web_seed_proxy", allow_threads(&session::web_seed_proxy), return_value_policy<copy_const_reference>())
.def("peer_proxy", allow_threads(&session::peer_proxy))
.def("tracker_proxy", allow_threads(&session::tracker_proxy))
.def("web_seed_proxy", allow_threads(&session::web_seed_proxy))
#endif
.def("set_proxy", allow_threads(&session::set_proxy))
.def("proxy", allow_threads(&session::proxy))
.def("start_upnp", &start_upnp)
.def("stop_upnp", allow_threads(&session::stop_upnp))
.def("start_lsd", allow_threads(&session::start_lsd))
@ -371,7 +379,7 @@ void bind_session()
.def("start_natpmp", &start_natpmp)
.def("stop_natpmp", allow_threads(&session::stop_natpmp))
.def("set_ip_filter", allow_threads(&session::set_ip_filter))
.def("get_ip_filter", allow_threads(&session::get_ip_filter), return_value_policy<copy_const_reference>())
.def("get_ip_filter", allow_threads(&session::get_ip_filter))
.def("find_torrent", allow_threads(&session::find_torrent))
.def("get_torrents", &get_torrents)
.def("pause", allow_threads(&session::pause))

View File

@ -127,6 +127,11 @@ void bind_session_settings()
.def_readwrite("report_true_downoaded", &session_settings::report_true_downloaded)
.def_readwrite("strict_end_game_mode", &session_settings::strict_end_game_mode)
.def_readwrite("broadcast_lsd", &session_settings::broadcast_lsd)
.def_readwrite("ignore_resume_timestamps", &session_settings::ignore_resume_timestamps)
.def_readwrite("anonymous_mode", &session_settings::anonymous_mode)
.def_readwrite("tick_interval", &session_settings::tick_interval)
.def_readwrite("report_web_seed_downloads", &session_settings::report_web_seed_downloads)
.def_readwrite("share_mode_target", &session_settings::share_mode_target)
;
enum_<proxy_settings::proxy_type>("proxy_type")

View File

@ -341,6 +341,8 @@ void bind_torrent_handle()
.def("force_dht_announce", _(&torrent_handle::force_dht_announce))
.def("scrape_tracker", _(&torrent_handle::scrape_tracker))
.def("name", _(&torrent_handle::name))
.def("set_upload_mode", _(&torrent_handle::set_upload_mode))
.def("set_share_mode", _(&torrent_handle::set_share_mode))
.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))

View File

@ -168,8 +168,7 @@ void bind_torrent_info()
;
class_<file_entry>("file_entry")
.add_property(
"path"
.add_property("path"
, make_getter(
&file_entry::path, return_value_policy<copy_non_const_reference>()
)
@ -181,7 +180,7 @@ void bind_torrent_info()
class_<announce_entry>("announce_entry", init<std::string const&>())
.def_readwrite("url", &announce_entry::url)
.def_readwrite("tier", &get_tier)
.add_property("tier", &get_tier)
.add_property("fail_limit", &get_fail_limit)
.add_property("fails", &get_fails)
.add_property("source", &get_source)
@ -197,4 +196,12 @@ void bind_torrent_info()
.def("is_working", &announce_entry::is_working)
.def("trim", &announce_entry::trim)
;
enum_<announce_entry::tracker_source>("tracker_source")
.value("source_torrent", announce_entry::source_torrent)
.value("source_client", announce_entry::source_client)
.value("source_magnet_link", announce_entry::source_magnet_link)
.value("source_tex", announce_entry::source_tex)
;
}

View File

@ -78,6 +78,11 @@ void bind_torrent_status()
.def_readonly("seeding_time", &torrent_status::seeding_time)
.def_readonly("seed_rank", &torrent_status::seed_rank)
.def_readonly("last_scrape", &torrent_status::last_scrape)
.def_readonly("has_incoming", &torrent_status::has_incoming)
.def_readonly("sparse_regions", &torrent_status::sparse_regions)
.def_readonly("seed_mode", &torrent_status::seed_mode)
.def_readonly("upload_mode", &torrent_status::upload_mode)
.def_readonly("share_mode", &torrent_status::share_mode)
.def_readonly("error", &torrent_status::error)
.def_readonly("priority", &torrent_status::priority)
;