Re: [libtorrent] how to support selection download
Brought to you by:
arvidn
From: Arvid N. <c9...@cs...> - 2005-05-13 00:52:39
|
MooPolice wrote: >> >> You'd have to add code to piece_picker::add_interesting_blocks() to >> make it ignore pieces that should not be downloaded. And also >> (probably the hardest part) make the storage skip pieces that belong >> (entirely) to certain files. The easiest thing to do this is probably >> to fill all the files with zeroes and then write the downloaded pieces >> as usual. Because some pieces has to be downloaded because they partly >> belong to a file that should be downloaded, and partly belong to a >> file that shouln't be. >> > I am looking forward to get such code implementation! Whoever will do > (did) it plz share this code with me. > :) > > btw: Is there any easy way to force storage to write all downloaded > pieces into their final slots so > that one has completed files of a multi file torrent actually on disk as > the correct file? I tried to remove the actual allocation of pieces (where zeroes are written to the files) but that turned out not to work. My assert that tell() say the same thing as I pass to seek() failed. This is on darwin (osx). Anyway, I added an option to start a torrent with the traditional allocate-every-piece-before-download strategy. Perhaps a bit inelegant solution, but it is the easiest way I can see to handle the case of parts of pieces that are at the end of an, otherwise unallocated, file. Assuming seek() can't pass the end of the file, that file needs to be filled with zeroes in order to hold the last partial piece at the end. So, there's a bool parameter to session::add_torrent() that controls this. Documentation has been updated too (on cvs). At least its a start. Filtering which pieces to download should be a piece of cake. Then to actually not allocate the files that aren't to be downloaded.. I don't know a good way to do that. -- Arvid Norberg |