- Rust 100%
| src | ||
| tests | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
knyga
A CLI app that re-links your PocketBook notes to a book after you've re-tagged its metadata.
The problem
PocketBook identifies books in its library by file hash, not ISBN or any stable ID. Touch the EPUB's metadata (fix a typo in the author, swap the cover, normalize the title) and the hash changes. The device now sees a brand-new book and silently orphans every highlight, bookmark, and note you ever made on it. Your annotations still live in the device's databases, but they point at a hash that no longer matches anything on disk. Dead references.
Subjectively, hashing the whole file as a book identity is a questionable design choice. Objectively, it's what ships, and we have to work around it.
The fix
The app rewrites the stale hash inside PocketBook's on-device databases so your notes reattach to the re-tagged file. No re-reading, no manually re-creating highlights, no losing progress.
Demo
A walkthrough of the tool in action: on peertube.in.ua.
Recommended companion tools
When you edit an EPUB's metadata, use tools that respect the spec.
- Sigil — open-source EPUB2/EPUB3 editor. Preserves OPF/NCX/Nav structure as-is and ships with built-in EPUBCheck validation.
- EPUBCheck — the official W3C validator. Run
epubcheck book.epubafter any edit to confirm the file is still spec-compliant before copying it back to the device.
Shell completions (fish)
Generate the completion script and drop it in fish's completions directory:
knyga completions fish > ~/.config/fish/completions/knyga.fish
A note on authorship
This README was written partly with the help of an LLM, and the reverse engineering of PocketBook's database format also partly involved an LLM. The code itself, however, was written by hand by a human.