feat: add a Books tab for e-books, comics, and audio books - #151
Open
ugurckr wants to merge 1 commit into
Open
Conversation
Books are the other large category the curated list has no answer for, and both general sources already carry them: apibay files e-books (601) and comics (602) under Other and audio books (102) under Audio, and BitTorrented has an ebook media type. One tab, not two. baairon#118 proposed E-Books and Audiobooks as separate categories; the format is already in the torrent's own name, the two share every source, and splitting them means asking the same two sites twice for what one request answers. Someone looking for a novel does not usually care whether it arrives as EPUB or as narration. Browse needs two feeds here, because the two halves live under different apibay parents (600 and 102). fetchBrowse merges them and settles for a partial list: one feed answering beats reporting the whole source down, while both failing still throws so the tab reports the outage honestly. The category filter now also runs over browse feeds, which it has to: 600 is the parent Other feed and carries far more than books. Movies and TV browse their own leaf feeds (207, 208), already admitted by their own category sets, so the filter is a no-op there — with a test pinning that. A row that carries no category at all is kept rather than dropped.
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
Books are the other large category the curated list has no answer for, and both general sources
already carry them:
type=ebookNo new integration, no new site to trust — two source entries over indexes torlink already talks to.
One tab, not two
#118 proposed E-Books and Audiobooks as separate categories. I think one tab is the better
shape, for three reasons:
.epub,.pdf,.cbz,m4b, "narrated by" —the row tells you what it is without a tab having to.
request answers, and torlink is a client that cares about how many requests a tab costs.
it arrives as EPUB or as narration — and if they do, the name says so.
The tab is also where FitGirl's exclusion logic points: books are inert text and audio, the same
class as video and subtitles, so they need no special trust treatment.
Browse needs two feeds
The two halves live under different apibay parents — 600 (Other) for e-books and comics, 102 for
audio books — so the empty-query view merges two top-100s.
fetchBrowsesettles for a partiallist: one feed answering beats reporting the whole source down, while both failing still
throws, so a real outage still reaches the tab's error line. Both paths are tested.
The category filter now runs over browse feeds too (
if (q && …)→if (it.category && …)),which it has to: 600 is a parent feed carrying far more than books. Movies and TV browse their own
leaf feeds (207, 208), which their category sets already admit, so the filter is a no-op for
them — there's a regression test pinning exactly that, in both search and browse. A row with no
category at all is kept rather than dropped: an unfiled row beats an empty tab.
Grain notes
MediaTypeinbittorrented.tsreplaces the inline"video"literal, so the second value was atype entry rather than a new branch.
type=ebookmeans the tab structurally cannot show avideo row.
Storefields, no palette or gradient changes. The new tags reuse theirsite's existing colour.
Tests
piratebay.test.tsis new (7 cases): the three-category boundary, the two-feed merge, one feeddown (partial list), both down (throws), the unfiled-row rule, and Movies unchanged in search and
browse. Plus a wiring case in
bittorrented.test.ts.npm testgoes from 229 to 237 passing.Checklist
npm run typecheckis cleannpm testpassesHELP_GROUPSandfooterHintsinsrc/ui/keymap.tsStorefield, I updatedmakeStoreinscripts/render-previews-impl.tsxfeat:/fix:/docs:/chore:)