From 516d8b72f6afb5277f86d59d9677078fe0500827 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 7 Apr 2007 03:37:23 +0000 Subject: [PATCH] fixed python bindings for recent api updates and added support for extensions --- bindings/python/src/extensions.cpp | 7 ++++++- bindings/python/src/session.cpp | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/bindings/python/src/extensions.cpp b/bindings/python/src/extensions.cpp index 90a5d6722..f8fb30bdf 100755 --- a/bindings/python/src/extensions.cpp +++ b/bindings/python/src/extensions.cpp @@ -1,4 +1,4 @@ -// Copyright Daniel Wallin 2007. Use, modification and distribution is +// Copyright Daniel Wallin, Arvid Norberg 2007. Use, modification and distribution is // subject to the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include "gil.hpp" @@ -139,5 +141,8 @@ void bind_extensions() // TODO move to it's own file class_("peer_connection", no_init); + + def("create_ut_pex_plugin", create_ut_pex_plugin); + def("create_metadata_plugin", create_metadata_plugin); } diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 01b9c50aa..4ee1a67a3 100755 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -1,9 +1,10 @@ -// Copyright Daniel Wallin 2006. Use, modification and distribution is +// Copyright Daniel Wallin, Arvid Norberg 2006. Use, modification and distribution is // subject to the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include +#include #include #include "gil.hpp" @@ -75,6 +76,14 @@ namespace s.add_extension(invoke_extension_factory(e)); } + torrent_handle add_torrent(session& s, torrent_info const& ti + , boost::filesystem::path const& save, entry const& resume + , bool compact, int block_size) + { + return s.add_torrent(ti, save, resume, compact, block_size + , default_storage_constructor); + } + } // namespace unnamed void bind_session() @@ -136,14 +145,6 @@ void bind_session() #endif ; - torrent_handle (session::*add_torrent0)( - torrent_info const& - , boost::filesystem::path const& - , entry const& - , bool - , int - ) = &session::add_torrent; - class_("session", session_doc, no_init) .def( init(arg("fingerprint")=fingerprint("LT",0,1,0,0), session_init_doc) @@ -162,7 +163,7 @@ void bind_session() .def("dht_state", allow_threads(&session::dht_state), session_dht_state_doc) #endif .def( - "add_torrent", allow_threads(add_torrent0) + "add_torrent", &add_torrent , ( arg("torrent_info"), "save_path", arg("resume_data") = entry() , arg("compact_mode") = true, arg("block_size") = 16 * 1024