官方是這樣寫的:
session s;
s.listen_on(std::make_pair(6881, 6889));
add_torrent_params p;
p.save_path = "./";
p.ti = new torrent_info(argv[1]);
s.add_torrent(p);
但是這樣寫的話是下載整個種子的檔案api上也沒說怎么寫(也許是我沒看懂,因為C++沒怎么學)
求指導怎么用python呼叫libtorrent下載種子指定檔案
uj5u.com熱心網友回復:
argv[1]是檔案名?uj5u.com熱心網友回復:
map_file()
peer_request map_file(int file_index, size_type file_offset
, int size) const;
This function will map a range in a specific file into a range in the torrent. The file_offset parameter is the offset in the file, given in bytes, where 0 is the start of the file. The peer_request structure looks like this:
struct peer_request
{
int piece;
int start;
int length;
bool operator==(peer_request const& r) const;
};
piece is the index of the piece in which the range starts. start is the offset within that piece where the range starts. length is the size of the range, in bytes.
The input range is assumed to be valid within the torrent. file_offset + size is not allowed to be greater than the file size. file_index must refer to a valid file, i.e. it cannot be >= num_files().
uj5u.com熱心網友回復:
libtorrent API 幫助,挨個找http://www.rasterbar.com/products/libtorrent/manual.html#torrent-info
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/140546.html
標籤:網絡及通訊開發
上一篇:急求!!!SUIPack.bpi
