Skip to content

feat: choose which files to exclude before and during a download - #159

Open
BRAINIFII wants to merge 1 commit into
baairon:mainfrom
BRAINIFII:feat/file-deselect
Open

feat: choose which files to exclude before and during a download#159
BRAINIFII wants to merge 1 commit into
baairon:mainfrom
BRAINIFII:feat/file-deselect

Conversation

@BRAINIFII

Copy link
Copy Markdown

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 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.

Checklist

  • npm run typecheck is clean
  • npm test passes
  • New logic has a test (vitest; mock node built-ins for platform code)
  • If I added a key, I updated both HELP_GROUPS and footerHints in src/ui/keymap.ts
  • If I added a Store field, I updated makeStore in scripts/render-previews-impl.tsx
  • OS-touching code works on Windows, macOS, and Linux
  • One concern, with a Conventional Commits title (feat: / fix: / docs: / chore:)

New here? CONTRIBUTING.md explains each of these with examples from real merged PRs.

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.
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

Successfully merging this pull request may close these issues.

1 participant