forked from premiere/premiere-libtorrent
Fix building bindings when TORRENT_NO_DEPRECATE is defined
Add 'performance_alert' to the bindings
This commit is contained in:
parent
5ab28ed37f
commit
e9dd8ce050
|
@ -56,7 +56,9 @@ void bind_alert()
|
|||
.def("message", &alert::message, alert_msg_doc)
|
||||
.def("what", &alert::what)
|
||||
.def("category", &alert::category)
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
.def("severity", &alert::severity, alert_severity_doc)
|
||||
#endif
|
||||
.def("__str__", &alert::message, alert_msg_doc)
|
||||
;
|
||||
|
||||
|
@ -79,8 +81,10 @@ void bind_alert()
|
|||
.value("status_notification", alert::status_notification)
|
||||
.value("progress_notification", alert::progress_notification)
|
||||
.value("ip_block_notification", alert::ip_block_notification)
|
||||
.value("performance_warning", alert::performance_warning)
|
||||
.value("all_categories", alert::all_categories)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
class_<torrent_alert, bases<alert>, noncopyable>(
|
||||
|
@ -350,4 +354,16 @@ void bind_alert()
|
|||
"save_resume_data_failed_alert", no_init
|
||||
);
|
||||
|
||||
class_<performance_alert, bases<torrent_alert>, noncopyable>(
|
||||
"performance_alert", no_init
|
||||
)
|
||||
.def_readonly("warning_code", &performance_alert::warning_code)
|
||||
;
|
||||
enum_<performance_alert::performance_warning_t>("performance_warning_t")
|
||||
.value("outstanding_disk_buffer_limit_reached", performance_alert::outstanding_disk_buffer_limit_reached)
|
||||
.value("outstanding_request_limit_reached", performance_alert::outstanding_request_limit_reached)
|
||||
;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -361,10 +361,12 @@ void bind_session()
|
|||
#endif
|
||||
.def("load_state", allow_threads(&session::load_state))
|
||||
.def("state", allow_threads(&session::state))
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
.def(
|
||||
"set_severity_level", allow_threads(&session::set_severity_level)
|
||||
, session_set_severity_level_doc
|
||||
)
|
||||
#endif
|
||||
.def("set_alert_mask", allow_threads(&session::set_alert_mask))
|
||||
.def("pop_alert", allow_threads(&session::pop_alert), session_pop_alert_doc)
|
||||
.def("add_extension", &add_extension)
|
||||
|
@ -387,5 +389,3 @@ void bind_session()
|
|||
|
||||
register_ptr_to_python<std::auto_ptr<alert> >();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -295,9 +295,11 @@ void bind_torrent_handle()
|
|||
.def("resolve_countries", _(resolve_countries1))
|
||||
#endif
|
||||
// deprecated
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
.def("filter_piece", _(&torrent_handle::filter_piece))
|
||||
.def("is_piece_filtered", _(&torrent_handle::is_piece_filtered))
|
||||
|
||||
.def("write_resume_data", _(&torrent_handle::write_resume_data))
|
||||
#endif
|
||||
.def("piece_availability", piece_availability)
|
||||
.def("piece_priority", _(piece_priority0))
|
||||
.def("piece_priority", _(piece_priority1))
|
||||
|
@ -306,7 +308,6 @@ void bind_torrent_handle()
|
|||
.def("prioritize_files", prioritize_files)
|
||||
.def("file_priorities", file_priorities)
|
||||
.def("use_interface", &torrent_handle::use_interface)
|
||||
.def("write_resume_data", _(&torrent_handle::write_resume_data))
|
||||
.def("save_resume_data", _(&torrent_handle::save_resume_data))
|
||||
.def("force_reannounce", _(force_reannounce0))
|
||||
.def("force_reannounce", force_reannounce)
|
||||
|
@ -331,4 +332,3 @@ void bind_torrent_handle()
|
|||
.def("rename_file", _(&torrent_handle::rename_file))
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,10 @@ namespace
|
|||
std::string result(ti.metadata().get(), ti.metadata_size());
|
||||
return result;
|
||||
}
|
||||
|
||||
torrent_info construct0(std::string path) {
|
||||
return torrent_info(fs::path(path));
|
||||
}
|
||||
} // namespace unnamed
|
||||
|
||||
void bind_torrent_info()
|
||||
|
@ -74,9 +78,12 @@ void bind_torrent_info()
|
|||
return_value_policy<copy_const_reference> copy;
|
||||
|
||||
class_<torrent_info, boost::intrusive_ptr<torrent_info> >("torrent_info", no_init)
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
.def(init<entry const&>())
|
||||
#endif
|
||||
.def(init<sha1_hash const&>())
|
||||
.def(init<char const*, int>())
|
||||
.def(init<boost::filesystem::path>())
|
||||
|
||||
.def("add_tracker", &torrent_info::add_tracker, (arg("url"), arg("tier")=0))
|
||||
.def("add_url_seed", &torrent_info::add_url_seed)
|
||||
|
@ -87,8 +94,9 @@ void bind_torrent_info()
|
|||
.def("total_size", &torrent_info::total_size)
|
||||
.def("piece_length", &torrent_info::piece_length)
|
||||
.def("num_pieces", &torrent_info::num_pieces)
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
.def("info_hash", &torrent_info::info_hash, copy)
|
||||
|
||||
#endif
|
||||
.def("hash_for_piece", &torrent_info::hash_for_piece)
|
||||
.def("piece_size", &torrent_info::piece_size)
|
||||
|
||||
|
@ -123,5 +131,3 @@ void bind_torrent_info()
|
|||
.def_readwrite("tier", &announce_entry::tier)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue