added new announce_entry members to python bindings. Also excluded deprecated functions from the python bindings when built without them

This commit is contained in:
Arvid Norberg 2009-12-21 22:02:34 +00:00
parent 0fc90b5655
commit 3c262bcd52
4 changed files with 42 additions and 1 deletions

View File

@ -224,7 +224,7 @@ def main():
ses.set_upload_rate_limit(int(options.max_upload_rate))
ses.listen_on(options.port, options.port + 10)
ses.set_settings(settings)
ses.set_severity_level(lt.alert.severity_levels.info)
# ses.set_severity_level(lt.alert.severity_levels.info)
ses.add_extension(lt.create_ut_pex_plugin)
ses.add_extension(lt.create_ut_metadata_plugin)
ses.add_extension(lt.create_metadata_plugin)

View File

@ -194,7 +194,9 @@ void bind_alert()
"file_error_alert", no_init
)
.def_readonly("file", &file_error_alert::file)
#ifndef TORRENT_NO_DEPRECATE
.def_readonly("msg", &file_error_alert::msg)
#endif
;
class_<metadata_failed_alert, bases<torrent_alert>, noncopyable>(
@ -223,7 +225,9 @@ void bind_alert()
)
.def_readonly("mapping", &portmap_error_alert::mapping)
.def_readonly("type", &portmap_error_alert::type)
#ifndef TORRENT_NO_DEPRECATE
.def_readonly("msg", &portmap_error_alert::msg)
#endif
;
class_<portmap_alert, bases<alert>, noncopyable>(
@ -238,13 +242,17 @@ void bind_alert()
"portmap_log_alert", no_init
)
.def_readonly("type", &portmap_log_alert::type)
#ifndef TORRENT_NO_DEPRECATE
.def_readonly("msg", &portmap_log_alert::msg)
#endif
;
class_<fastresume_rejected_alert, bases<torrent_alert>, noncopyable>(
"fastresume_rejected_alert", no_init
)
#ifndef TORRENT_NO_DEPRECATE
.def_readonly("msg", &fastresume_rejected_alert::msg)
#endif
;
class_<peer_blocked_alert, bases<alert>, noncopyable>(
@ -343,7 +351,9 @@ void bind_alert()
class_<peer_disconnected_alert, bases<peer_alert>, noncopyable>(
"peer_disconnected_alert", no_init
)
#ifndef TORRENT_NO_DEPRECATE
.def_readonly("msg", &peer_disconnected_alert::msg)
#endif
;
class_<request_dropped_alert, bases<peer_alert>, noncopyable>(
@ -370,13 +380,17 @@ void bind_alert()
class_<torrent_delete_failed_alert, bases<torrent_alert>, noncopyable>(
"torrent_delete_failed_alert", no_init
)
#ifndef TORRENT_NO_DEPRECATE
.def_readonly("msg", &torrent_delete_failed_alert::msg)
#endif
;
class_<save_resume_data_failed_alert, bases<torrent_alert>, noncopyable>(
"save_resume_data_failed_alert", no_init
)
#ifndef TORRENT_NO_DEPRECATE
.def_readonly("msg", &save_resume_data_failed_alert::msg)
#endif
;
class_<performance_alert, bases<torrent_alert>, noncopyable>(

View File

@ -122,8 +122,10 @@ void bind_peer_info()
// read/write state
pi.attr("bw_idle") = (int)peer_info::bw_idle;
#ifndef TORRENT_NO_DEPRECATE
pi.attr("bw_torrent") = (int)peer_info::bw_torrent;
pi.attr("bw_global") = (int)peer_info::bw_global;
#endif
pi.attr("bw_network") = (int)peer_info::bw_network;
}

View File

@ -83,6 +83,17 @@ namespace
return result;
}
bool get_verified(announce_entry const& ae)
{ return ae.verified; }
bool get_updating(announce_entry const& ae)
{ return ae.updating; }
bool get_start_sent(announce_entry const& ae)
{ return ae.start_sent; }
bool get_complete_sent(announce_entry const& ae)
{ return ae.complete_sent; }
bool get_send_stats(announce_entry const& ae)
{ return ae.send_stats; }
} // namespace unnamed
void bind_torrent_info()
@ -163,5 +174,19 @@ void bind_torrent_info()
class_<announce_entry>("announce_entry", init<std::string const&>())
.def_readwrite("url", &announce_entry::url)
.def_readwrite("tier", &announce_entry::tier)
.add_property("fail_limit", &announce_entry::fail_limit)
.add_property("fails", &announce_entry::fails)
.add_property("source", &announce_entry::source)
.add_property("verified", &get_verified)
.add_property("updating", &get_updating)
.add_property("start_sent", &get_start_sent)
.add_property("complete_sent", &get_complete_sent)
.add_property("send_stats", &get_send_stats)
.def("reset", &announce_entry::reset)
.def("failed", &announce_entry::failed, arg("retry_interval") = 0)
.def("can_announce", &announce_entry::can_announce)
.def("is_working", &announce_entry::is_working)
.def("trim", &announce_entry::trim)
;
}