Choose which part of the file to download

I am trying to develop my own torrenting application using Python . After some research, I decided to go with libtorrent and found this interesting answer:

I found another similar question with one answer:

but there I couldn't figure out how to do it, I read the full documentation they link in the question and got no idea on how to handle this.

I searched libtorrent trying to figure out how I can manage the download ...

  • How do I start my download from start to finish?

My goal is to start downloading the torrent "in order", that is, I don't want to download random parts of the torrent, the ones that are available at the moment, I would like to download from start to finish.

If anyone tried this and could point me to the correct libtorrent library would be great !!!


  • How can I start downloading the ordered file? set_sequential_download()

But how can I wait for pieces? How do I configure libtorrent to wait for the first 10 pieces before the next 10 starts?

+3


source to share


1 answer


The easiest way to download the snippets in order is to call set_sequential_download () on the torrent_handle for that torrent. This order of pieces, starting at chunk 0, 1, 2, etc. The order files are loaded based on the order they are listed in the .torrent file (ie, often seemingly arbitrary).



Note that this will make the parts of the libtorrent request in order, they may not necessarily complete in order. If what you really want is file streaming, that is, play on download, you want to aim for filling in the parts in order, which makes little difference. For streaming, you want to watch set_piece_deadline () , which will request such pieces using a different assembly mechanism .

+6


source







All Articles