Skip to main content
  1. Today I Learned (TIL)/

calibredb for headless library work

·165 words·1 min·

Today I learned to stop opening the Calibre GUI just to fix metadata. While building some cleanup tooling for my library, I leaned on calibredb, the command-line interface that ships with Calibre and does almost everything the desktop app does, minus the clicking.

The unlock is that it’s scriptable. calibredb add pulls a book in, calibredb set_metadata fixes a wrong author or series, calibredb list queries the catalog, calibredb remove cleans up. Point it at a library path and you can batch-fix a few hundred books that all imported with the wrong publisher.

That’s what my calibre-tool cleanup scripts lean on now: the janitorial work that’s miserable in a GUI, normalizing series names, stripping junk tags, deduping, becomes a loop you run and walk away from.

One catch: calibredb talks to the library on disk, so if the desktop app is open and holding the database, the CLI can collide with it. Close the app, or point at the content server, before a batch run.

Chandler Thompson
Author
Chandler Thompson
I lead engineering teams and coach the people who run them. This is where I write down what actually worked.

Related