python binding fixes
This commit is contained in:
parent
f70fbb45c0
commit
00efe29f9e
|
@ -22,11 +22,26 @@ namespace
|
||||||
obj(i);
|
obj(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
void set_piece_hashes_callback(create_torrent& c, std::string const& p
|
void set_piece_hashes_callback(create_torrent& c, std::string const& p
|
||||||
, boost::python::object cb)
|
, boost::python::object cb)
|
||||||
{
|
{
|
||||||
set_piece_hashes(c, p, boost::bind(call_python_object, cb, _1));
|
set_piece_hashes(c, p, boost::bind(call_python_object, cb, _1));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void set_piece_hashes_callback(create_torrent& c, std::string const& p
|
||||||
|
, boost::python::object cb)
|
||||||
|
{
|
||||||
|
error_code ec;
|
||||||
|
set_piece_hashes(c, p, boost::bind(call_python_object, cb, _1), ec);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_piece_hashes0(create_torrent& c, std::string const & s)
|
||||||
|
{
|
||||||
|
error_code ec;
|
||||||
|
set_piece_hashes(c, s, ec);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void add_node(create_torrent& ct, std::string const& addr, int port)
|
void add_node(create_torrent& ct, std::string const& addr, int port)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +62,9 @@ void bind_create_torrent()
|
||||||
void (file_storage::*set_name1)(std::wstring const&) = &file_storage::set_name;
|
void (file_storage::*set_name1)(std::wstring const&) = &file_storage::set_name;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
void (*set_piece_hashes0)(create_torrent&, std::string const&) = &set_piece_hashes;
|
void (*set_piece_hashes0)(create_torrent&, std::string const&) = &set_piece_hashes;
|
||||||
|
#endif
|
||||||
void (*add_files0)(file_storage&, std::string const&, boost::uint32_t) = add_files;
|
void (*add_files0)(file_storage&, std::string const&, boost::uint32_t) = add_files;
|
||||||
|
|
||||||
class_<file_storage>("file_storage")
|
class_<file_storage>("file_storage")
|
||||||
|
|
|
@ -44,7 +44,12 @@ namespace {
|
||||||
p.auto_managed = params["auto_managed"];
|
p.auto_managed = params["auto_managed"];
|
||||||
p.duplicate_is_error = params["duplicate_is_error"];
|
p.duplicate_is_error = params["duplicate_is_error"];
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
return add_magnet_uri(s, uri, p);
|
return add_magnet_uri(s, uri, p);
|
||||||
|
#else
|
||||||
|
error_code ec;
|
||||||
|
return add_magnet_uri(s, uri, p, ec);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ namespace
|
||||||
s.add_extension(invoke_extension_factory(e));
|
s.add_extension(invoke_extension_factory(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
torrent_handle add_torrent_depr(session& s, torrent_info const& ti
|
torrent_handle add_torrent_depr(session& s, torrent_info const& ti
|
||||||
, std::string const& save, entry const& resume
|
, std::string const& save, entry const& resume
|
||||||
|
@ -66,6 +67,7 @@ namespace
|
||||||
allow_threading_guard guard;
|
allow_threading_guard guard;
|
||||||
return s.add_torrent(ti, save, resume, storage_mode, paused, default_storage_constructor);
|
return s.add_torrent(ti, save, resume, storage_mode, paused, default_storage_constructor);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
torrent_handle add_torrent(session& s, dict params)
|
torrent_handle add_torrent(session& s, dict params)
|
||||||
|
@ -112,21 +114,24 @@ namespace
|
||||||
if (params.has_key("override_resume_data"))
|
if (params.has_key("override_resume_data"))
|
||||||
p.override_resume_data = params["override_resume_data"];
|
p.override_resume_data = params["override_resume_data"];
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
return s.add_torrent(p);
|
return s.add_torrent(p);
|
||||||
|
#else
|
||||||
|
error_code ec;
|
||||||
|
return s.add_torrent(p, ec);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void start_natpmp(session& s)
|
void start_natpmp(session& s)
|
||||||
{
|
{
|
||||||
allow_threading_guard guard;
|
allow_threading_guard guard;
|
||||||
s.start_natpmp();
|
s.start_natpmp();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void start_upnp(session& s)
|
void start_upnp(session& s)
|
||||||
{
|
{
|
||||||
allow_threading_guard guard;
|
allow_threading_guard guard;
|
||||||
s.start_upnp();
|
s.start_upnp();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alert const* wait_for_alert(session& s, int ms)
|
alert const* wait_for_alert(session& s, int ms)
|
||||||
|
@ -147,16 +152,16 @@ namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_GEO_IP
|
#ifndef TORRENT_DISABLE_GEO_IP
|
||||||
bool load_asnum_db(session& s, std::string file)
|
void load_asnum_db(session& s, std::string file)
|
||||||
{
|
{
|
||||||
allow_threading_guard guard;
|
allow_threading_guard guard;
|
||||||
return s.load_asnum_db(file.c_str());
|
s.load_asnum_db(file.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool load_country_db(session& s, std::string file)
|
void load_country_db(session& s, std::string file)
|
||||||
{
|
{
|
||||||
allow_threading_guard guard;
|
allow_threading_guard guard;
|
||||||
return s.load_country_db(file.c_str());
|
s.load_country_db(file.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -303,6 +308,7 @@ void bind_session()
|
||||||
.def("dht_proxy", allow_threads(&session::dht_proxy), return_value_policy<copy_const_reference>())
|
.def("dht_proxy", allow_threads(&session::dht_proxy), return_value_policy<copy_const_reference>())
|
||||||
#endif
|
#endif
|
||||||
.def("add_torrent", &add_torrent)
|
.def("add_torrent", &add_torrent)
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
.def(
|
.def(
|
||||||
"add_torrent", &add_torrent_depr
|
"add_torrent", &add_torrent_depr
|
||||||
|
@ -312,6 +318,7 @@ void bind_session()
|
||||||
arg("paused") = false
|
arg("paused") = false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
.def("remove_torrent", allow_threads(&session::remove_torrent), arg("option") = session::none
|
.def("remove_torrent", allow_threads(&session::remove_torrent), arg("option") = session::none
|
||||||
)
|
)
|
||||||
|
|
|
@ -83,6 +83,14 @@ namespace
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get_tier(announce_entry const& ae)
|
||||||
|
{ return ae.tier; }
|
||||||
|
bool get_fail_limit(announce_entry const& ae)
|
||||||
|
{ return ae.fail_limit; }
|
||||||
|
bool get_fails(announce_entry const& ae)
|
||||||
|
{ return ae.fails; }
|
||||||
|
bool get_source(announce_entry const& ae)
|
||||||
|
{ return ae.source; }
|
||||||
bool get_verified(announce_entry const& ae)
|
bool get_verified(announce_entry const& ae)
|
||||||
{ return ae.verified; }
|
{ return ae.verified; }
|
||||||
bool get_updating(announce_entry const& ae)
|
bool get_updating(announce_entry const& ae)
|
||||||
|
@ -173,10 +181,10 @@ void bind_torrent_info()
|
||||||
|
|
||||||
class_<announce_entry>("announce_entry", init<std::string const&>())
|
class_<announce_entry>("announce_entry", init<std::string const&>())
|
||||||
.def_readwrite("url", &announce_entry::url)
|
.def_readwrite("url", &announce_entry::url)
|
||||||
.def_readwrite("tier", &announce_entry::tier)
|
.def_readwrite("tier", &get_tier)
|
||||||
.add_property("fail_limit", &announce_entry::fail_limit)
|
.add_property("fail_limit", &get_fail_limit)
|
||||||
.add_property("fails", &announce_entry::fails)
|
.add_property("fails", &get_fails)
|
||||||
.add_property("source", &announce_entry::source)
|
.add_property("source", &get_source)
|
||||||
.add_property("verified", &get_verified)
|
.add_property("verified", &get_verified)
|
||||||
.add_property("updating", &get_updating)
|
.add_property("updating", &get_updating)
|
||||||
.add_property("start_sent", &get_start_sent)
|
.add_property("start_sent", &get_start_sent)
|
||||||
|
|
Loading…
Reference in New Issue