Automation scripts + SQL helpers for managing Book Orbit libraries
  • JavaScript 54.5%
  • TypeScript 45.5%
Find a file
2026-09-26 14:44:33 -06:00
scripts feat: initial Book Orbit automation scripts 2026-08-25 16:49:30 -06:00
sql feat(sql): add reusable dedup SQL helpers for duplicate book cleanup 2026-08-26 09:34:48 -06:00
src fix: correct path parsing for file moves 2026-08-25 17:19:39 -06:00
.gitignore chore: ignore graft's local graph cache 2026-09-26 14:44:33 -06:00
config.js feat: initial Book Orbit automation scripts 2026-08-25 16:49:30 -06:00
package-lock.json feat: initial Book Orbit automation scripts 2026-08-25 16:49:30 -06:00
package.json feat: initial Book Orbit automation scripts 2026-08-25 16:49:30 -06:00
README.md feat(sql): add reusable dedup SQL helpers for duplicate book cleanup 2026-08-26 09:34:48 -06:00
tsconfig.json feat: initial Book Orbit automation scripts 2026-08-25 16:49:30 -06:00

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

  1. Copy .env.example to .env
  2. 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