Automation scripts + SQL helpers for managing Book Orbit libraries
- JavaScript 54.5%
- TypeScript 45.5%
| 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
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