swaitsandClaude Fable 5.2 e65b10c0fb Keep retrying lookups until the sources answer
A network error, timeout, 5xx or 429 no longer ends a lookup or sends a
book to Needs attention. Lookups back off exponentially with jitter (2 s
doubling to 5 min, honouring Retry-After) for as long as the book is
pending, keep each definitive answer so a retry only asks for what is
missing, and limit requests to two at a time per host. Once a call number
is in hand, a step that still fails after six tries is left for the
backfills. Books an earlier version failed for a temporary reason are
queued again at startup.

The cards show which source is not answering and when the next try is,
title search waits for Open Library with a Cancel button, and Look up
again sits next to Fix.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 11:35:37 -07:00
2026-11-19 12:54:16 -07:00

Booksorter

A small local web app for labelling a personal library with Library of Congress call numbers. Hold a book's barcode up to a laptop webcam (or type the ISBN), and Booksorter looks up the call number from the Library of Congress and Open Library, builds a spine label, and prints cards on Avery 5388 sheets (three 3 x 5 inch cards per sheet). Everything runs on your own machine; the only outside traffic is the book lookups made by the server.

Install and run

npm install
npm start

npm start builds the web app into dist/web and serves it at http://localhost:4321 (only reachable from this computer). Set PORT to use another port. If the port is taken, the server says so and exits.

Requires a recent Node (the server runs TypeScript directly).

Using it

The header has Scan, Library (N) and a gear for settings.

Scan is the home screen. On the left are the camera, the last book handled, and one entry box. Hold a barcode in the box on the video (a beep and a green flash mean it was read), press Capture or Space for one careful picture, or type an ISBN and press Enter (a USB barcode scanner does the same). The same box takes an LCCN (from the copyright page) or a title: type Dune by Frank Herbert, pick a result, or choose Not listed? Enter it by hand. On the right, Cards to print lists every queued book, books needing attention first. Use Fix on a book that needs attention, or the x to remove it (with 6 seconds to undo). A book already printed is only taken off the list, never deleted.

Print opens a small panel: pick where the first card goes on the sheet (handy for a partly used sheet), then Make PDF. Cards are printed in shelf order on Avery 5388 sheets (three 3 x 5 inch cards).

  1. Open the PDF and print at Actual size / 100% (never "Fit to page"), single-sided, through the manual feed slot.
  2. When the cards came out correctly, answer Yes, clear them so they are not printed twice.

Library shows every book in shelf order, grouped by main class, with search and a Needs attention filter. Click a book to edit it, print another card, look it up again, or delete it. A number marked ~ was borrowed from another edition or from similar books; check those.

How a number is found. A number is only ever printed without ~ when it came word for word from a catalogue record (Library of Congress, then Open Library) for this exact ISBN or LCCN, and has at least one cutter. Nothing is generated for those. A record that gives only a bare class (such as GV199.42, which in that class needs a place cutter next, not an author) is treated as a hint: the app then looks at other editions of the same book in that class, then at similar books in that class, and borrows from them with ~. If it finds nothing better it prints the bare class and this edition's year with ~. Books that share a number are shelved by the first author's surname, then title. Look up again ignores every saved answer and asks the catalogues afresh.

Settings (the gear) holds the camera picker and printer alignment. If the text sits off-centre on the cards, print the calibration page on plain paper, hold it against a real sheet up to the light, and enter the X and Y offsets in millimetres (limit 10). They are saved and applied to every later PDF. Every printed sheet also carries small crop marks outside the cards; they should point exactly at the perforations, so you can check the alignment by eye.

Where the data lives

In data/booksorter.db (SQLite) in this folder, created on first run. Back it up by copying the file while the server is stopped. Set BOOKSORTER_DB to use a different file.

Tests

npm test            # unit and server tests
npm run typecheck
S
Description
Scan books, look up Library of Congress call numbers, print 3x5 shelf cards
Readme MIT
529 KiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 97.9%
CSS 2%