calibredb

From RaySoft

calibredb is the command line interface to the Calibre database.[1]

NOTE:
On macOS, the command line tools are inside the Calibre bundle, e.g. /Applications/calibre.app/Contents/console.app/Contents/MacOS/.

Documentation

Syntax

calibredb [GLOBAL-PARAMETER ...] SUBCOMMAND EBOOK [EBOOK ...]

Subcommands & Parameters

Global parameters
The following parameters can be used with the subcommands below:
--dont-notify-gui
Do not notify the running Calibre GUI (if any) that the database has changed. Use with care, as it can lead to database corruption!
add
Add the specified files as books to the database.
-a AUTHORS, --authors AUTHORS
Set the AUTHORS of the added book(s).
-c PATH, --cover PATH
PATH to the cover to use for the added book.
-d, --duplicates,
Add books to database even if they already exist. Comparison is done based on book titles.
-l LANGUAGES, --languages LANGUAGES
A comma separated list of LANGUAGES.
-t TITLE, --title TITLE
Set the TITLE of the added book(s)
-T TAGS, --tags TAGS
Set the TAGS of the added book(s).
add (Additional parameters for directories)
You can also specify directories.
-1, --one-book-per-directory
Assume that each directory has only a single logical book and that all files in it are different e-book formats of that book.
-r, --recurse
Process directories recursively.
list
List the books available in the Calibre database.
--ascending
Sort results in ascending order.
-f FIELDS, --fields FIELDS
The FIELDS to display when listing books in the database. Should be a comma separated list of fields.
Available fields: author_sort, authors, comments, cover, formats, id, identifiers, isbn, languages, last_modified, pubdate, publisher, rating, series, series_index, size, tags, timestamp, title, uuid. Default: title,authors. The special field all can be used to select all fields.
--for-machine
Generate output in JSON format, which is more suitable for machine parsing. Causes the line width and separator options to be ignored.
--limit NUMBER
The maximum NUMBER of results to display. Default: all.
-s QUERY, --search QUERY
Filter the results by the search QUERY. For the format of the search query, please see the search related documentation in the User Manual.
--sort-by FIELDS
The FIELDS by which to sort the results.
Available fields: author_sort, authors, comments, cover, formats, id, identifiers, isbn, languages, last_modified, pubdate, publisher, rating, series, series_index, size, tags, timestamp, title, uuid. Default: id.

Examples

Import an ebook by command line
calibre --shutdown-running-calibre
calibredb add --one-book-per-directory '.'

References