feat: export a search result as .torrent without downloading it - #125
Merged
baairon merged 2 commits intoJul 31, 2026
Merged
Conversation
Lets you grab the .torrent file for a torrent you haven't downloaded yet straight from the details view, fetching just the metadata over the network (destroying the handle the instant it arrives) or reusing a cached .torrent if one already exists. Bound to `s` in the details view to mirror the existing "export" key on the downloads page, at the cost of overloading `s` with "sort" in the results list (see PR description for the tradeoff). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X8mRpPSwcUzB2p4zJQtnQm
chrispyles
marked this pull request as ready for review
July 29, 2026 02:06
Owner
|
Thanks for this, and for raising the key question instead of picking silently. I was interested in merging it from the start. On the keys, let's split them: Three things to fix up first:
Push those and I will get CI running on it. |
Splits sort and export back apart per review: s stays Sort (used far more often) and e becomes Export in the results detail view, freeing up the duplicate s row in the ? sheet. fetchAndExportTorrent now races the metadata fetch against a 20s timeout so a no-peer magnet resolves null instead of hanging forever. Shortening the help label back under the packing threshold restores the four-column layout at 136 cols. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X8mRpPSwcUzB2p4zJQtnQm
Contributor
Author
|
@baairon thanks for the review; I've pushed the changes you requested. Please let me know if any more changes are needed. |
Owner
|
merged! thank you |
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.
Summary
Adds an
sshortcut in the results details view that fetches a torrent's.torrentmetadata and exports it to your download folder without starting a download. If the metadata is already cached from a prior download, it's copied out immediately; otherwise it does a metadata-only fetch (DownloadQueue.fetchAndExportTorrentinsrc/download/queue.ts) and tears the torrent handle down the instant metadata arrives, before any piece data can hit disk.sin the details view (?sheet + footer) now triggers the export.footerHints) and help sheet (HELP_GROUPS) both updated, per the keymap system insrc/ui/keymap.ts.StoregainedfetchAndExportTorrentand aresultFocusfield (mirrors the existingdownloadFocus/seedFocuspattern) so the footer can tell list mode from detail mode and swap theshint's label accordingly.makeStoreinscripts/render-previews-impl.tsxand the test harness stub updated for the newStorefields.src/download/queue.test.tsfor the cached-metadata fast path, the already-active guard, the network fetch + immediate-teardown path, and the error path.One decision I'd like opinions on
The downloads page already binds
s→ "Export torrent file" for items you've downloaded. To stay consistent with that, this PR also bindss→ export in the results details view — but the results view already usessfor "Sort results" in list mode. Since sort is list-mode-only and export is detail-mode-only, they don't collide at runtime, but the?help sheet ends up listingstwice under "Search" with two different meanings (sort vs. export), which could read as a typo rather than two context-dependent bindings.The alternative is
e, which is unused in the results view but already means "open folder" on the downloads/seeding pages — so either ways/eends up meaning something different depending on which screen you're on.Tradeoff as I see it:
s(current choice): consistent verb-to-action mapping across screens ("export" is alwayss), but duplicates a key within one help-sheet group.e: no duplicate key within a single group, but the same letter now means two different things depending on which screen you're on (export in results, open-folder in downloads/seeding) — which is arguably worse for muscle memory, since the mismatch isn't visible in one place the way the duplicatesrow is.Happy to go either way — wanted to surface it rather than pick silently.
Test plan
npm run typecheck— cleannpm test— 229/229 runnable tests pass. Note:src/download/queue.test.ts(which includes the new coverage) can't execute in the sandbox this PR was authored in due to a pre-existing, unrelated native-module build issue (node-datachannel) — confirmed via a from-source rebuild attempt that it's a toolchain bug, not something this change caused. Would appreciate a CI run / localnpm testconfirmation on this file specifically.Checklist
npm run typecheckis cleannpm testpassesHELP_GROUPSandfooterHintsinsrc/ui/keymap.tsStorefield, I updatedmakeStoreinscripts/render-previews-impl.tsxfeat:/fix:/docs:/chore:)🤖 Generated with Claude Code
https://claude.ai/code/session_01X8mRpPSwcUzB2p4zJQtnQm