anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.51k stars 622 forks source link

Is there a way to stop downloading and delete a single file? #797

Closed Kidsunbo closed 1 year ago

Kidsunbo commented 1 year ago

I have a torrent file which contains serveral files can be downloaded. The first time I am downloading A and serveral minutes later, I want to stop downloading A and downloading B. So the A become no-needed and I would like to delete it.

But I notice that there seems no way to do such thing. I can stop downloading one file with setting the priority to PiecePriorityNone. But I don't have a way to delete the file with this library. I've already tried to delete it with os.Remove. But it seems that the priority change needs time to take effect, so the deleted file will still be created after it's deleted and trash left.

anacrolix commented 1 year ago

Depending on the storage implementation you're using, parts of files you don't want will still be visible as they share pieces with other files, usually on the boundaries of the files.

Kidsunbo commented 1 year ago

Depending on the storage implementation you're using, parts of files you don't want will still be visible as they share pieces with other files, usually on the boundaries of the files.

Yeah that makes sense. Is there any tutorial for the storage part?

anacrolix commented 1 year ago

Sorry there isn't. There's a lot of tests that mess around with it in https://github.com/anacrolix/torrent/tree/master/test.

anacrolix commented 1 year ago

There's also quite a few issues discussing specialized implementations there should be a lot of answers there.

anacrolix commented 1 year ago

And https://github.com/anacrolix/torrent/discussions.