fixes bug where priorities where lost when force-rechecking.
[libtorrent.git] / bindings / python / src / utility.cpp
blob9ae2d2a93d3009f6349963a53676a439d288f7a1
1 // Copyright Daniel Wallin 2006. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #include <libtorrent/identify_client.hpp>
6 #include <libtorrent/bencode.hpp>
7 #include <boost/python.hpp>
9 using namespace boost::python;
10 using namespace libtorrent;
12 object client_fingerprint_(peer_id const& id)
14 boost::optional<fingerprint> result = client_fingerprint(id);
15 return result ? object(*result) : object();
18 entry bdecode_(std::string const& data)
20 return bdecode(data.begin(), data.end());
23 std::string bencode_(entry const& e)
25 std::string result;
26 bencode(std::back_inserter(result), e);
27 return result;
30 void bind_utility()
32 def("identify_client", &libtorrent::identify_client);
33 def("client_fingerprint", &client_fingerprint_);
34 def("bdecode", &bdecode_);
35 def("bencode", &bencode_);