Home > Back-end >  The specified file in python call libtorrent download seeds
The specified file in python call libtorrent download seeds

Time:10-22

The official is written like this:
The session s;
S.l isten_on (STD: : make_pair (6881, 6889));
Add_torrent_params p;
P. ave_path="./";
P.t I=new torrent_info (argv [1]).
S.a dd_torrent (p);
But this is to download the seed files API also didn't say how to write (maybe I didn't understand, because no how to learn c + +)
Please guide how to use python call libtorrent specified file download seeds

CodePudding user response:

Argv [1] is the file name?

CodePudding user response:

 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;
Boolean operator==(peer_request const& R) const;
};

Piece is the index of the piece in which the range starts. Start by the offset within that piece where the range starts. The length is the size of the range, in bytes.

The input range is assumed to be valid within The torrent. File_offset + The size is not allowed to be greater than The file size. The file_index must refer to a valid file, i.e. for The it always be & gt;=num_files ().

CodePudding user response:

Libtorrent API help, each looking for
http://www.rasterbar.com/products/libtorrent/manual.html#torrent-info
  • Related