- JavaScript 50.6%
- TypeScript 42.2%
- Python 7.2%
book_files.file_hash only groups identical files, so two rips of one edition look like two books to every hash query, to BookOrbit's own duplicate scan, and to the ISBN screens. This prints the numbers that separate them: the text word count for edition identity and the image payload for rip quality. Reproduces the Reborn as a Space Mercenary volume-1 pair exactly - 59,508 words on both sides, 12.6 MB vs 6.6 MB of images - which is what picked the keeper. --tails handles the case where the word counts differ, by showing whether the extra text is publisher back matter or a missing passage. |
||
|---|---|---|
| scripts | ||
| sql | ||
| src | ||
| .gitignore | ||
| config.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Book Orbit Scripts
Automation scripts for managing Book Orbit libraries.
Scripts
epub_profile.py
Compares EPUBs by content instead of hash, for the duplicate class file_hash cannot see:
two rips of the same volume (different hashes, different sizes, same book). Stdlib only.
Usage:
python3 scripts/epub_profile.py A.epub B.epub # profile both
python3 scripts/epub_profile.py --tails A.epub B.epub # + what only one side contains
Same text_words means the same edition; img_bytes picks the better rip (the downsampled
scene release runs ~2x smaller with identical text). See skill bookorbit-dedup
§ Duplicate class 2 and docs/plans/space-mercenary-audiobook-batch.md in homelab.
move-lightnovels.js
Moves light novels from books-library to light-novels-library.
Features:
- Login to Book Orbit
- Detect duplicates using hash table (O(n + m) complexity)
- Remove duplicates from books-library
- Move remaining books to light-novels-library
- Generate detailed reports
Usage:
npm run move
test-move.js
Tests connection to Book Orbit and verifies library access.
Usage:
npm run test
Configuration
- Copy
.env.exampleto.env - Fill in your Book Orbit credentials:
BOOKORBIT_URL=http://192.168.1.50:3006 BOOKORBIT_EMAIL=your@email.com BOOKORBIT_PASSWORD=yourpassword
Authors to Process
The script processes these light novel authors:
- Sunsunsun and Momoco (42 books)
- SUNSUNSUN (31 books)
- Nisioisin (10 books)
- Sunsunsun (8 books)
- NISIOISIN (3 books)
- Wataru Watari (1 book)
Duplicate Detection
Uses hash table for O(n + m) complexity:
- Exact match: title|author
- Normalized match: case-insensitive, special chars removed
- SHA256 match: if available
SQL Helpers (dedup)
Reusable SQL for finding and cleaning duplicate book records by content-file
hash. See sql/README.md for usage.
| File | Purpose |
|---|---|
01-detect-cross-lib-dups.sql |
Hashes present in 2+ libraries |
02-detect-intra-lib-dups.sql |
Hashes in 2+ books within one library |
03-backup-delete-set.sql |
CSV backups + reading-data check before delete |
04-safe-delete-analysis.sql |
Keep/delete classification (multi-format safety) |
05-orphan-check.sql |
Safety gate: no content hash left without a twin |
06-delete-books.sql |
Delete book records (cascade) |
07-verify-clean.sql |
Post-cleanup verification (all counts → 0) |
Output
Reports are saved to reports/ directory.
Logs are saved to logs/ directory.
Requirements
- Node.js
- Playwright
- Chromium browser