feat: choose which files to exclude before and during a download - #159
Open
BRAINIFII wants to merge 1 commit into
Open
feat: choose which files to exclude before and during a download#159BRAINIFII wants to merge 1 commit into
BRAINIFII wants to merge 1 commit into
Conversation
Season packs and repacks often carry files you don't want — a sample clip, a second language track, bonus junk. Until now every file in a torrent came down; the only way to skip one was to let it finish and delete it afterward. Add a file picker, reached with `x` on a search result. It fetches the torrent's file list (from the cached .torrent when present, otherwise a metadata-only swarm fetch that pulls no file data), then lets you drop files before the download starts. Single-file torrents and unreadable lists fall through to a normal download, so `x` never dead-ends. Excluded files are applied by adding the torrent deselected and selecting only the kept files once metadata arrives, so skipped files never touch disk. The engine tracks the selected byte total and rescales progress/eta against it, since webtorrent's own progress counts the whole torrent and would otherwise stall below 100%. The choice rides on the QueueItem (and through history to seeds), so a resume, retry, or re-seed re-applies the same exclusions. `x` in the Downloads pane re-opens the picker for a download already in flight, preloaded with its current selection. The change is applied to the live torrent in place — only the newly excluded files are deselected and the kept ones re-asserted, so selections never empty out (which would drop peer interest and stall the download). Already downloaded pieces stay on disk and are never re-fetched. Wires the new `x` into both halves of the keymap (the `?` sheet and the Downloads footer) and the requestFileSelection/requestReselect Store fields into makeStore, per CONTRIBUTING. Covered with vitest: engine select/deselect mapping and progress rescaling, queue persistence and live reselect, and the picker's toggle logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Season packs and repacks often carry files you don't want — a sample clip, a second language track, bonus junk. Until now every file in a torrent came down; the only way to skip one was to let it finish and delete it afterward.
Add a file picker, reached with
xon a search result. It fetches the torrent's file list (from the cached .torrent when present, otherwise a metadata-only swarm fetch that pulls no file data), then lets you drop files before the download starts. Single-file torrents and unreadable lists fall through to a normal download, soxnever dead-ends.Excluded files are applied by adding the torrent deselected and selecting only the kept files once metadata arrives, so skipped files never touch disk. The engine tracks the selected byte total and rescales progress/eta against it, since webtorrent's own progress counts the whole torrent and would otherwise stall below 100%. The choice rides on the QueueItem (and through history to seeds), so a resume, retry, or re-seed re-applies the same exclusions.
xin the Downloads pane re-opens the picker for a download already in flight, preloaded with its current selection. The change is applied to the live torrent in place — only the newly excluded files are deselected and the kept ones re-asserted, so selections never empty out (which would drop peer interest and stall the download). Already downloaded pieces stay on disk and are never re-fetched.Wires the new
xinto both halves of the keymap (the?sheet and the Downloads footer) and the requestFileSelection/requestReselect Store fields into makeStore, per CONTRIBUTING. Covered with vitest: engine select/deselect mapping and progress rescaling, queue persistence and live reselect, and the picker's toggle logic.Checklist
npm run typecheckis cleannpm testpassesHELP_GROUPSandfooterHintsinsrc/ui/keymap.tsStorefield, I updatedmakeStoreinscripts/render-previews-impl.tsxfeat:/fix:/docs:/chore:)New here? CONTRIBUTING.md explains each of these with examples from real merged PRs.