1
// Copyright Daniel Wallin & Arvid Norberg 2009. 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 <boost/python.hpp>
6
#include <libtorrent/create_torrent.hpp>
7
#include <libtorrent/file_storage.hpp>
8
#include "libtorrent/intrusive_ptr_base.hpp"
10
using namespace boost::python;
11
using namespace libtorrent;
13
void bind_create_torrent()
15
void (file_storage::*add_file0)(file_entry const&) = &file_storage::add_file;
16
void (file_storage::*add_file1)(fs::path const&, size_type) = &file_storage::add_file;
18
class_<file_storage>("file_storage")
19
.def("is_valid", &file_storage::is_valid)
20
.def("add_file", add_file0)
21
.def("add_file", add_file1)
22
.def("num_files", &file_storage::num_files)
23
.def("at", &file_storage::at, return_internal_reference<>())
24
.def("total_size", &file_storage::total_size)
25
.def("set_num_pieces", &file_storage::set_num_pieces)
26
.def("num_pieces", &file_storage::num_pieces)
27
.def("set_piece_length", &file_storage::set_piece_length)
28
.def("piece_length", &file_storage::piece_length)
29
.def("piece_size", &file_storage::piece_size)
30
.def("set_name", &file_storage::set_name)
31
.def("name", &file_storage::name, return_internal_reference<>())
34
class_<create_torrent>("create_torrent", no_init)
35
.def(init<file_storage&>())
36
.def(init<file_storage&, int>())
38
.def("generate", &create_torrent::generate)
40
.def("files", &create_torrent::files, return_internal_reference<>())
41
.def("set_comment", &create_torrent::set_comment)
42
.def("set_creator", &create_torrent::set_creator)
43
.def("set_hash", &create_torrent::set_hash)
44
.def("add_url_seed", &create_torrent::add_url_seed)
45
.def("add_node", &create_torrent::add_node)
46
.def("add_tracker", &create_torrent::add_tracker)
47
.def("set_priv", &create_torrent::set_priv)
48
.def("num_pieces", &create_torrent::num_pieces)
49
.def("piece_length", &create_torrent::piece_length)
50
.def("piece_size", &create_torrent::piece_size)
51
.def("priv", &create_torrent::priv)