fix python build by exposing the correct constructors for torrent_info, along with default values. Also, avoid making a redundant copy of the torrent_info in dict_to_add_torrent_params

This commit is contained in:
Arvid Norberg 2011-06-08 03:40:14 +00:00
parent 7bea10a698
commit 2bfa8005d4
2 changed files with 8 additions and 6 deletions

View File

@ -144,8 +144,9 @@ namespace
void dict_to_add_torrent_params(dict params, add_torrent_params& p, std::vector<char>& rd)
{
// torrent_info objects are always held by an intrusive_ptr in the python binding
if (params.has_key("ti"))
p.ti = new torrent_info(extract<torrent_info const&>(params["ti"]));
p.ti = extract<torrent_info const*>(params["ti"]);
std::string url;
if (params.has_key("tracker_url"))

View File

@ -135,13 +135,14 @@ void bind_torrent_info()
class_<torrent_info, boost::intrusive_ptr<torrent_info> >("torrent_info", no_init)
#ifndef TORRENT_NO_DEPRECATE
.def(init<entry const&>())
.def(init<entry const&, int>((arg("e"), arg("flags") = 0)))
#endif
.def(init<sha1_hash const&>())
.def(init<char const*, int>())
.def(init<std::string>())
.def(init<sha1_hash const&, int>((arg("info_hash"), arg("flags") = 0)))
.def(init<char const*, int>((arg("file"), arg("flags") = 0)))
.def(init<std::string, int>((arg("file"), arg("flags") = 0)))
.def(init<torrent_info const&, int>((arg("ti"), arg("flags") = 0)))
#if TORRENT_USE_WSTRING
.def(init<std::wstring>())
.def(init<std::wstring, int>((arg("file"), arg("flags") = 0)))
#endif
.def("add_tracker", &torrent_info::add_tracker, arg("url"))