Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Torrent being downloaded completely soon after mounted #72

Open
fabianski7 opened this issue Mar 31, 2021 · 11 comments
Open

Torrent being downloaded completely soon after mounted #72

fabianski7 opened this issue Mar 31, 2021 · 11 comments

Comments

@fabianski7
Copy link

Well, I'm sorry if this is an invalid bug and this is the default behavior of btfs, but the description in the readme says that the files are downloaded as needed, not all at once.

The contents of the files will be downloaded on-demand as they are read by applications

I am using version 2.24 from the archlinux repository, with kernel 5.11.11 and kde plasma 5.21.3

@johang
Copy link
Owner

johang commented Jul 15, 2021

This is by design. Parts that are read by applications are prioritized, but if there is bandwidth available it will download the rest of the torrent.

@fabianski7
Copy link
Author

is there any way to change this?

@johang
Copy link
Owner

johang commented Jul 16, 2021

You can patch the function setup() in btfs.cc to set all files to priority 0.

@fabianski7
Copy link
Author

@johang
Copy link
Owner

johang commented Jul 16, 2021

@pkillnine
Copy link

@johang how would you set all the files to priority 0? I'd like to patch this as well to prevent it downloading as soon as it's mounted.

@johang
Copy link
Owner

johang commented Oct 13, 2021

Look in libtorrents docs (torrent_handle::file_priority(...)).

@pkillnine
Copy link

pkillnine commented Oct 13, 2021

@johang thanks, this patch seems to work - note that once a file is accessed it attempts to download the whole thing. Is it possible to set it so it only downloads what is accessed, rather than the whole file?

diff --git a/src/btfs.cc b/src/btfs.cc
index 1f4a72d..4da1ebe 100644
--- a/src/btfs.cc
+++ b/src/btfs.cc
@@ -205,6 +205,7 @@ setup() {
 		handle.pause();
 
 	for (int i = 0; i < ti->num_files(); ++i) {
+		handle.file_priority(i, 0);
 		std::string parent("");
 
 #if LIBTORRENT_VERSION_NUM < 10100

@leadenhead
Copy link

This is by design. Parts that are read by applications are prioritized, but if there is bandwidth available it will download the rest of the torrent.

Same problem. There is no point in this utility without the "download files as needed" feature. It's not about the available bandwidth. You can download the torrent using qbittorrent. The point is the available disk space. You need to be able to view a specific file. But qbittorrent can do that too. Therefore, it is very important to download "only some parts" of the file. For example, when previewing video or audio (when searching). It would be nice to use some amount of cache (configurable), which would not save data to disk. For example, provided that the file is viewed by no more than 10 percent. Or work without saving to disk at all.

btfs 2.24-1 / archlinux 5.15.3-arch1-1 / spectrwm

@rienafairefr
Copy link

If anyone interested, I've patched btfs to handle the "no fetch" case, where pieces are downloaded only when really needed, no auto-downloading of anything except what's asked to be read through fuse, in a branch here https://github.com/rienafairefr/btfs/tree/no-fetch

@OliverOffing
Copy link

Check out https://github.com/distribyted/distribyted too — solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants