3

I'm trying to develop my own torrent app using Python. After some research I decided to go with libtorrent, and found this interesting answer:

I've found also another similar question with one answer:

but there I couldn't understand how to do it, I read the full documentation they link in the question and didn't get any idea about how to face this.

I've been looking around libtorrent trying to understand how could I manage the download...

  • How could I to start downloading from the beginning to the end ?

My goal is to start the download the torrent "ordered", meaning I don't want to download random parts of the torrent, the ones availables at the moment, I would like to download it from the beginning to the end.

If anybody has try this and could point me to the right libtorrent documentation would be awesome !!!


  • How could I start to download the file ordered ? --> set_sequential_download()

But how could I wait for the pieces ? How do I configure libtorrent to wait for the first 10 pieces until begin with the next 10 ?

4

1 回答 1

6

按顺序下载片段的最简单方法是在该 torrent 的 torrent_handle 上调用set_sequential_download() 。这就是片断顺序,从片断 0、1、2 等开始。顺序文件的下载取决于它们在 .torrent 文件中指定的顺序(即,通常是看似任意的顺序)。

请注意,这将使 libtorrent请求按顺序排列,它们不一定按顺序完成。如果您真正想要的是流式传输文件,即在下载时播放,您希望按顺序完成片段,这有细微的差别。对于流式传输,您需要查看set_piece_deadline(),它将使用不同的片段挑选机制请求此类片段。

于 2014-12-19T08:21:39.693 回答