diff --git a/README.md b/README.md index 43257d9..f0b1b34 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,8 @@ By default it listens on http://127.0.0.1:3030. "POST /torrents/{index}/delete": "Forget about the torrent, remove the files", "POST /torrents/{index}/forget": "Forget about the torrent, keep the files", "POST /torrents/{index}/pause": "Pause torrent", - "POST /torrents/{index}/start": "Resume torrent" + "POST /torrents/{index}/start": "Resume torrent", + "POST /torrents/{index}/update_only_files": "Change the selection of files to download. You need to POST json of the following form {"only_files": [0, 1, 2]}" }, "server": "rqbit" } diff --git a/crates/librqbit/src/chunk_tracker.rs b/crates/librqbit/src/chunk_tracker.rs index 8f03dd9..21590b0 100644 --- a/crates/librqbit/src/chunk_tracker.rs +++ b/crates/librqbit/src/chunk_tracker.rs @@ -493,10 +493,10 @@ mod tests { let bf_len = l.piece_bitfield_bytes(); let initial_have = BF::from_boxed_slice(vec![0u8; bf_len].into_boxed_slice()); - let initial_needed = BF::from_boxed_slice(vec![u8::MAX; bf_len].into_boxed_slice()); + let initial_selected = BF::from_boxed_slice(vec![u8::MAX; bf_len].into_boxed_slice()); // Initially, we need all files and all pieces. - let mut ct = ChunkTracker::new(initial_needed.clone(), initial_have.clone(), l).unwrap(); + let mut ct = ChunkTracker::new(initial_have.clone(), initial_selected.clone(), l).unwrap(); // Select all file, no changes. assert_eq!( @@ -509,7 +509,7 @@ mod tests { } ); assert_eq!(ct.have, initial_have); - assert_eq!(ct.queue_pieces, initial_needed); + assert_eq!(ct.queue_pieces, initial_selected); // Select only the first file. println!("Select only the first file."); diff --git a/crates/librqbit/src/http_api.rs b/crates/librqbit/src/http_api.rs index 44fc9d9..ccb0a5e 100644 --- a/crates/librqbit/src/http_api.rs +++ b/crates/librqbit/src/http_api.rs @@ -64,6 +64,7 @@ impl HttpApi { "POST /torrents/{index}/start": "Resume torrent", "POST /torrents/{index}/forget": "Forget about the torrent, keep the files", "POST /torrents/{index}/delete": "Forget about the torrent, remove the files", + "POST /torrents/{index}/update_only_files": "Change the selection of files to download. You need to POST json of the following form {\"only_files\": [0, 1, 2]}", "POST /torrents": "Add a torrent here. magnet: or http:// or a local file.", "POST /rust_log": "Set RUST_LOG to this post launch (for debugging)", "GET /web/": "Web UI",