expose post_torrent_updates and state_update_alert to python bindings

This commit is contained in:
Arvid Norberg 2012-08-10 06:33:53 +00:00
parent 9a11c44984
commit 670437c375
4 changed files with 20 additions and 0 deletions

View File

@ -1,6 +1,7 @@
* fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP
* expose post_torrent_updates and state_update_alert to python bindings
* fix incorrect SSL error messages
* fix windows build of shared library with openssl
* fix race condition causing shutdown hang

View File

@ -51,6 +51,18 @@ list stats_alert_transferred(stats_alert const& alert)
return result;
}
list get_status_from_update_alert(state_update_alert const& alert)
{
list result;
for (std::vector<torrent_status>::const_iterator i = alert.status.begin(); i != alert.status.end(); ++i)
{
result.append(*i);
}
return result;
}
void bind_alert()
{
using boost::noncopyable;
@ -341,6 +353,11 @@ void bind_alert()
.def_readonly("prev_state", &state_changed_alert::prev_state)
;
class_<state_update_alert, bases<alert>, noncopyable>(
"state_update_alert", no_init)
.add_property("status", &get_status_from_update_alert)
;
class_<dht_reply_alert, bases<tracker_alert>, noncopyable>(
"dht_reply_alert", no_init)
.def_readonly("num_peers", &dht_reply_alert::num_peers)

View File

@ -513,6 +513,7 @@ void bind_session()
arg("fingerprint")=fingerprint("LT",0,1,0,0)
, arg("flags")=session::start_default_features | session::add_default_plugins))
)
.def("post_torrent_updates", allow_threads(&session::post_torrent_updates))
.def(
"listen_on", &listen_on
, (arg("min"), "max", arg("interface") = (char const*)0, arg("flags") = 0)

View File

@ -24,6 +24,7 @@ object verified_pieces(torrent_status const& s) { return bitfield_to_list(s.veri
void bind_torrent_status()
{
scope status = class_<torrent_status>("torrent_status")
.def_readonly("info_hash", &torrent_status::info_hash)
.def_readonly("state", &torrent_status::state)
.def_readonly("paused", &torrent_status::paused)
.def_readonly("auto_managed", &torrent_status::auto_managed)