A tool to organize metadata from a Calibre library. The tool's strategy is to leverage Calibre's own command line management API.
Calibre provides several options for categorizing and tagging books programmatically. Here's how Caliborg tries to achieve the desired result:
-
Export Metadata
-
Use Calibre's
calibredbcommand-line tool to export the metadata of all books into a JSON file (which will be referenced by the environment variableLIBRARY_PATH):<CALIBRE-INSTALL-PATH>/calibredb list --fields title,authors,author_sort,tags,isbn --for-machine > library.json
-
-
Analyze Metadata
- Parse the metadata file and analyze the titles, authors, and descriptions to categorize books.
-
Set Categories
- Use keywords in titles or descriptions to assign categories (e.g., "programming," "fiction," "history").
- Match against a predefined list of authors or keywords for each category.
-
Apply Tags
-
Use
calibredbset_metadata or a Calibre plugin to apply the generated tags or categories back to your library. -
The program will generate a shell script containing several instructions following this template (one for each book):
calibredb set_metadata --ids <book_id> --tags <tags>
-
You'll need a .env file with the GOOGLE_BOOKS_API_KEY and LIBRARY_PATH environment variables. There's also a DEBUG environment variable that can be set to true to enable debug logs.
Run build make command with tests
make allBuild the application
make buildRun the application
make runRun the test suite:
make testClean up binary from the last build:
make clean