Scroll to navigation

CALIBREDB(1) calibre CALIBREDB(1)

NAME

calibredb - calibredb

calibredb command [options] [arguments]


calibredb 是 Calibre 数据库的命令行接口。它包含多个子命令(详见下文说明)。

calibredb 可用于操作指定的本地库路径,也可操作运行在本机或互联网上的 Calibre“内容服务器”。您可以使用 calibre-server 程序启动服务器,或者在 Calibre 主界面点击“连接/共享 -> 启动内容服务器”。由于 calibredb 具有修改书库的权限,您必须先在服务器上配置身份验证。有两种实现方式:

  • 如果您仅计划连接到运行在同一台电脑上的服务器,只需开启内容服务器的 --enable-local-write 选项,即可允许包括 calibredb 在内的任何本机程序修改数据。在主程序中,该选项位于“首选项 -> 通过网络共享 -> 高级选项”中。但请务必小心,因为某些浏览器(主要是 Firefox)允许任意网站访问本地服务器。如果您使用 Firefox,建议按照下文所述设置用户名和密码。截至 Firefox v149 版本,仍未实现对“本地网络访问”的限制。
  • 如果您希望开启互联网访问,则应在服务器上设置用户账户,并在使用 calibredb 时配合 --username 和 --password 选项进行授权。对于 calibre-server,可以使用 --enable-auth 开启验证,并使用 --manage-users 创建账户。若是在主程序中,请前往“首选项 -> 通过网络共享 -> 要求使用用户名和密码”。

若要连接到正在运行的内容服务器,请将服务器的 URL 传递给 --with-library 选项,具体细节和示例请参阅该选项的说明文档。

  • 全局选项
  • list
  • add
•
正在从文件夹中添加

  • remove
  • add_format
  • remove_format
  • show_metadata
  • set_metadata
  • export
  • catalog
•
EPUB 个选项

  • saved_searches
  • add_custom_column
  • custom_columns
  • remove_custom_column
  • set_custom
  • restore_database
  • check_library
  • list_categories
  • backup_metadata
  • clone
  • embed_metadata
  • search
  • fts_index
  • fts_search
  • notes
  • items
  • virtual_libraries
  • annotations
  • trash
  • data_files

全局选项

显示此帮助信息并退出

calibre 书库的路径。默认是使用存储在设置中的路径。您还可以连接到 calibre 内容服务器,以便在远程书库上执行操作。为此使用此格式的URL:<http://hostname:port/#library_id>。例如, <http://localhost:8080/#mylibrary>。library_id是要在内容服务器上连接的书库的书库id。您可以使用特殊的library_id值 - 来获得服务器上可用书库id的列表。有关如何通过内容服务器设置访问的详情,请参阅https://manual.calibre-ebook.com/generated/en/calibredb.html。

连接到 calibre 内容服务器的密码。若要从标准输入读取密码,请使用特殊值:<stdin>。若要从文件读取密码,请使用<f:/path/to/file>(即<f:后跟文件的完整路径和尾随 >)。上面的角括号是必需的,记住要转义它们,或者使用引号。

通过网络连接到calibre书库时的超时时间,以秒为单位。默认值为两分钟。

用于连接到内容服务器的用户名

显示程序版本号并退出

LIST

calibredb list [options]


列出 calibre 数据库中可用书籍。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

升序排列结果

在列出数据库中书籍时要显示的字段。应该是逗号分隔的字段列表。 可用字段: author_sort, authors, comments, cover, formats, identifiers, isbn, languages, last_modified, pubdate, publisher, rating, series, series_index, size, tags, template, timestamp, title, uuid 默认值:title,authors。特殊字段“all”可用于选择所有字段。除了上述内置字段之外,还可以通过 *field_name (检索名)选择自定义字段,例如,对于自定义字段#rating,使用名称:*rating

以 JSON 格式输出,更适合机器解析。会导致忽略每行长度和分隔符选项。

显示的最大结果数。默认:全部

输出中的单行宽度最大值。默认为检测到的屏幕大小。

所有文件路径的前缀。默认为书库文件夹绝对路径。

通过搜索请求筛选结果。对于搜索请求的格式,请参见用户手册中搜索相关的文档。默认为不做筛选。

用于分隔字段的字符串。默认是空格。

用于对结果进行排序的字段。您可以通过使用逗号*分隔的方式指定多个字段。 可用字段: author_sort, authors, comments, cover, formats, identifiers, isbn, languages, last_modified, pubdate, publisher, rating, series, series_index, size, tags, template, timestamp, title, uuid 默认值: id。除了上述的内置字段外,自定义字段也可用,格式为 *field_name。例如,对于自定义字段 #rating,请使用名称:*rating

字段列表中出现"template"时要运行的模板。请注意,在连接到 calibre 服务器时,模板将被忽略。默认值:无

如果"template" 在字段列表中,则包含要运行的模板的文件的路径。默认值:无

模板栏的标题。默认值 template. 如果设置了选项:option:--for-machine ,则忽略此选项

ADD

calibredb add [选项] file1 file2 file3 ...


将指定文件当做书籍添加到数据库。你可以指定目录,请查看下面目录相关选项。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

设置已添加书籍的作者

如果找到具有类似书名和作者的书籍,自动将输入格式(文件)合并到现有书籍记录中。值“Ignore”表示丢弃重复的格式。值“overwrite”表示书库中的重复格式将被新添加的文件覆盖。值“new_record”表示将重复的格式放入新的书籍记录中。

设置已添加书籍的封面路径

即使已经存在,也添加书籍到数据库中。 根据书名和作者进行比较。 请注意,:option:
`
--automerge`选项优先。

添加空白书籍(无格式书籍)

设置书籍标识符,例如 -I asin:XXX -I isbn:YYY

设置已添加书籍的ISBN

逗号分割的语言列表(最好使用 ISO639 语言代码,尽管也能识别某些语言名称)

为添加的书籍设置丛书

为添加的书籍设置丛书编号

设置已添加书籍的标签

设置已添加书籍的书名

正在从文件夹中添加

用于控制从文件夹添加书籍的选项。默认情况下,只能添加那些受支持的电子书格式的文件。

文件名(规则为模糊匹配即glob)规则,在扫描文件夹中的文件时将添加与此规则匹配的文件,即使这些文件不是已知的电子书文件格式。可以多次指定多个规则。

文件名规则 (规则为模糊匹配即glob) ,在扫描文件夹中的文件时,与此规则匹配的文件将被忽略。可以多次指定多个规则。例如:*.pdf将忽略所有PDF文件

假设每个文件夹只有一本逻辑书籍,并且其中的所有文件都是该书籍的不同格式

递归处理文件夹

REMOVE

calibredb remove ids


从数据库删除指定id的书籍。id为以逗号分隔的 id 号列表(你可以使用搜索命令来获得 id 号)。例如,23,34,57-85(如果指定一个区间,该区间的最后一个数字不会被包括在内)。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

Do not use the trash bin

ADD_FORMAT

calibredb add_format [options] id ebook_file


将 ebook_file中的电子书添加到由id标识的书籍的可用格式中。您可以使用搜索命令获取id。如果格式已经存在,则替换它,除非指定了不替换选项。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

将文件作为附加的数据文件而不是电子书格式添加到书籍中

如果格式已经存在不要替换它

REMOVE_FORMAT

calibredb remove_format [options] id fmt


从ID标识的逻辑书籍中删除特定格式- fmt。你可以通过使用搜索命令获取id。fmt 应该是形如LRF或TXT或EPUB的一个文件扩展名。如果逻辑书籍没有 fmt 可用则什么也不做。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

SHOW_METADATA

calibredb show_metadata [options] id


显示在 calibre 数据库中存储的指定id的书籍的元数据。 id是来自搜索命令的id号。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

以OPF格式(XML)打印元数据

SET_METADATA

calibredb set_metadata [options] book_id [/path/to/metadata.opf]


根据 OPF 文件 --metadata.opf 设置存储在 calibre 数据库中的以 book_id 标识的书籍的元数据。 book_id 是来自搜索命令的 id 号。您可以通过使用 --as-opf 切换到 show_metadata 命令来快速 了解 OPF 格式。还可以用 --field 选项设置各个字段的元数据。如果使用 --field 选项则 不需要指定 OPF 文件。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

设置字段。格式是field_name:value,例如:--field tags:tag1,tag2。使用:option:--list-fields`来获取所有字段名称的列表。你可以多次指定此选项来设置多个字段。注意:对于语言,你必须使用ISO639语言代码(例如en代表英文,fr代表法语等)。对于书籍标识符,语法是:option:--field` identifiers:isbn:XXXX,doi:YYYYY。对于布尔(是/否)字段使用true 和 false 或者 yes 和 no。

列出可用于 --field 选项的元数据字段名称

EXPORT

calibredb export [options] ids


导出指定id(以逗号分隔的列表)的书籍至文件系统。 导出操作将保存书籍的所有格式,以及其封面和元数据(保存 至一个opf文件)。也会保存与书籍相关联的任何附加的数据文件。 你可以使用搜索命令来获得id。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

导出数据库中所有的书籍,忽略列表中的id。

让calibre将文件名中的所有非英文字符转换成英文对应字符。如果保存到不完全支持Unicode文件名的旧文件系统中,这将非常有用。 设定此项将关闭此操作。

通常,calibre将把封面保存为单独文件,和电子书文件一起生成。 设定此项将关闭此操作。

保存书籍时保存与书籍关联的所有数据文件 设定此项将关闭此操作。

通常,calibre将根据calibre书库中的信息更新保存的文件的元数据。这会使保存到硬盘变慢一些。 设定此项将关闭此操作。

通常,calibre 将会把元数据写入单独的 OPF 文件,和电子书文件一起生成。 设定此项将关闭此操作。

要保存的每本书籍的逗号分割的格式列表。默认保存所有可用格式。

报告进展

--replace-whitespace
用下划线替换空格。

导出所有书籍到单个文件夹

该模板用来控制保存到设备的文件的文件名和文件夹结构。默认是"{author_sort}/{title}/{title} - {authors}",它将把书籍保存到每个作者名命名的文件夹中,书籍文件名由书名和作者构成。可用的控制项是: {author_sort, authors, id, isbn, languages, last_modified, pages, pubdate, publisher, rating, series, series_index, tags, timestamp, title}

显示日期的格式。%d - 天, %b - 月, %m - 月份数字, %Y - 年。默认是: %b, %Y

导出书籍到指定文件夹。默认为 .

将路径转为小写。

CATALOG

calibredb catalog /path/to/destination.(csv|epub|mobi|xml...) [options]


以 path/to/destination extension 指定的格式导出书目。 选项控制项目在生成的书目中的显示方式。 请注意,不同的书目格式支持不同的选项。 要查看不同的选项,请指定输出文件的名称,然后指定 --help选项。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

要编目的逗号分割的数据库 ID 列表。 一旦声明,则忽略 --search 选项 默认值:all

按搜索查询筛选结果。搜索查询格式请参见用户手册中搜索相关内容。默认:no filtering

显示详细输出信息。有利于调试

EPUB 个选项

生成书目的标题,用作元数据中的书名。 默认值:'My Books' 适用于:AZW3,ePub,MOBI 等输出格式

为具有多个作者的书籍在作者部分中创建交叉引用。 默认值: 'False' 适用于: AZW3, EPUB, MOBI输出格式

将转换传输途径不同阶段的输出保存到指定文件夹。 如果您不确定在转换过程的哪个阶段发生错误,这很有用。 默认: 'None' 适用于: AZW3, EPUB, MOBI 的输出格式

用正则表达式描述要排除的视为类型的标签。 默认值: '[.+]|^+$' 不包括括号内的标签,例如 '[Project Gutenberg]', 和 '+', 默认的用于阅读书籍的标签。 适用于: AZW3, EPUB, MOBI 输出格式

指定用于从生成的书目中排除书籍的规则。 排除规则的模型是('<rule name>','标签','<comma-separated list of tags>') 或('<rule name>','<custom column>','<pattern>')。 例如: (('存档的书籍','#status'','已存档'),) 将在自定义列“status'”中排除值为“已存档”的书籍。定义多个规则时,将应用所有规则。 默认: "(('Catalogs','Tags','Catalog'),)" 适用于:AZW3, EPUB, MOBI 输出格式

书目中包括“作者”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式

书目中包括“描述”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式

书目中包括“类型”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式

书目中包括“入库日期”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式

书目中包括“丛书”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式

书目中包括“书名”部分。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式

“类型”部分的源字段。 默认值: '标签' 适用于: AZW3, EPUB, MOBI 输出格式

包含要插入到描述的头部位置的备注文本的自定义字段。 默认值: '' 适用于: AZW3, EPUB, MOBI输出格式

#<custom field>:[before|after]:[True|False] 设置: <custom field> 自定义字段包含与书籍简介合并的内容备注 [before|after] 书籍简介相关的内容备注的位置 [True|False] - 在内容备注和书籍简介之间插入水平线 默认值: '::' 适用于: AZW3, EPUB, MOBI 输出格式

--output-profile
指定'输出配置'。在某些情况下,输出配置用于优化某些设备的书目。例如,'kindle' 或 'kindle_dx' 生成带章节和文章的目录结构。默认:'None' 适用于:AZW3、EPUB、MOBI 等输出格式

--prefix-rules
指定用于包含表示已读书籍,愿望清单和其他用户指定前缀的前缀的规则。前缀规则的模型 ('<rule name>','<source field>','<pattern>','<prefix>')。 当定义了多个规则时,将使用第一个匹配规则 默认规则:"(('Read books','tags','+','✓'),('Wishlist item','tags','Wishlist','×'))"适用于:AZW3, EPUB, MOBI 输出格式

使用GUI书目生成器创建的命名预设。 预设指定用于构建书目的所有设置。 默认值: 'None' 适用于: AZW3, EPUB, MOBI 输出格式

书目中书籍封面的大小提示(英寸)。 范围: 1.0 - 2.0 默认值: '1.0' 适用于: AZW3, EPUB, MOBI 输出格式

在生成书目时替换现有的封面。 默认值: 'False' 适用于: AZW3, EPUB, MOBI 输出格式

SAVED_SEARCHES

calibredb saved_searches [options] [list|add|remove]


Manage the saved searches stored in this database. If you try to add a query with a name that already exists, it will be replaced.

Syntax for listing, the default action:

calibredb saved_searches list

Syntax for adding:

calibredb saved_searches add search_name search_expression

Syntax for removing:

calibredb saved_searches remove search_name

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

ADD_CUSTOM_COLUMN

calibredb add_custom_column [options] label name datatype


创建一个自定义列,列名为你自定义的名称,不能包含空格或冒号。数据类型可为:bool, comments, composite, datetime, enumeration, float, int, rating, series, text

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

用于自定义如何解释此列中的数据的选项的字典。这是一个 JSON 字符串。对于枚举列,使用 --display"{\ "enum_values\ ":[\ "val1\ ", \ "val2\ "]}" 有许多选项可以进入显示变量,按列类型的选项是: composite: composite_template, composite_sort, make_category,contains_html, use_decorations datetime: date_format enumeration: enum_values, enum_colors, use_decorations int, float: number_format text: is_names, use_decorations 找到适当组合的最好方法是在图形界面中创建适当类型的自定义列,然后查看书籍的备份 OPF(确保自从添加该栏目以后已经创建了新的 OPF)。在 OPF 中的新列中,你将看到 JSON 的“显示”。

此列存储类似标签的数据(例如,多个逗号分隔的值)。仅当数据类型为文本时才适用。

CUSTOM_COLUMNS

calibredb custom_columns [options]


列出可用的自定义列。显示栏目标签和id。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

显示每个列的详情。

REMOVE_CUSTOM_COLUMN

calibredb remove_custom_column [options] label


删除由标签标识的自定义列。可以使用custom_columns command命令查看可用列。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

无需确认

SET_CUSTOM

calibredb set_custom [options] column id value


为 id 标识的书籍设置自定义列的值。 您可以使用搜索命令获取id列表。 您可以使用 custom_columns 命令获取自定义列名的列表。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

如果列可以有多个值,将指定值添加到已有值之后,而非覆盖已有值。

RESTORE_DATABASE

calibredb restore_database [options]


Restore this database from the metadata stored in OPF files in each folder of the calibre library. This is useful if your metadata.db file has been corrupted.

WARNING: This command completely regenerates your database. You will lose all saved searches, user categories, plugboards, stored per-book conversion settings, and custom recipes. Restored metadata will only be as accurate as what is found in the OPF files.

The exit status is 0 if the restore succeeded, 1 if it failed completely and 2 if the database was restored but some books or other data could not be.

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

确认恢复。除非指定了此选项,否则命令不会运行。

CHECK_LIBRARY

calibredb check_library [options]


对书库的文件系统执行一些检查。报告是invalid_titles, extra_titles, invalid_authors, extra_authors, missing_formats, extra_formats, extra_files, missing_covers, extra_covers, malformed_formats, malformed_paths, failed_folders

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

以 CSV 输出

逗号分隔的将被忽略的扩展名列表。 默认值:all

逗号分隔的将被忽略的名称列表。 默认值:all

逗号分隔的报告列表。 默认值: all

清空全文检索数据库。根据数据库的大小,这可能会非常慢并且占用大量内存。

LIST_CATEGORIES

calibredb list_categories [options]


在数据库中生成一个类别信息的报告。 该信息与标签浏览器中显示的信息相同。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

逗号分隔类别列表检索名。默认值:全部

以 CSV 输出

产生CSV文件的类型。选择:excel, excel-tab, unix

只输出每个类别中的项(标签、作者等)的数目,而不是类别内的每项包含的书籍数

输出中的单行宽度最大值。默认为检测到的屏幕大小。

BACKUP_METADATA

calibredb backup_metadata [options]


将存储在数据库中的元数据备份到每个书籍文件夹中的 单个 OPF 文件中。这通常是自动的,但是您可以运行 此命令来强制重新生成 OPF 文件,并使用 --all 选项。

请注意,通常不需要这样做,因为每次元数据更改时, OPF 文件都会自动备份。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

通常,此命令只对OPF文件过期的书籍有效。这个选项使它在所有的书籍上运行。

CLONE

calibredb clone path/to/new/library


创建当前书库的副本。这将创建一个新的、空的书库,它所有的自定义列、虚拟书库和其他设置与当前书库相同。

副本书库将没有任何书籍。如果您想要创建一个完整的副本书库,包括所有的书籍,那么只需使用您的文件系统工具来复制书库文件夹。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

EMBED_METADATA

calibredb embed_metadata [options] book_id


通过calibre 数据库中的元数据更新存储在 calibre 书库中的实际书籍文件中的元数据。 通常,只有从 calibre 导出文件时才更新元数据,如果希望文件就地更新,则此命 令很有用。请注意,不同的文件格式支持不同数量的元数据。你可以使用book_id 的特殊值“all”来更新所有书籍中的元数据。还可以指定许多由空格分隔的书籍id 和由连字符分隔的ID区间。例如:calibredb embed_metadata 1 2 10-15 23

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

只更新指定格式的文件中的元数据。可为多种格式指定多次。默认情况下,所有格式都会更新。

SEARCH

calibredb search [options] search expression


搜索书库中指定的搜索项,返回与搜索表达式匹配的以逗号分隔的书籍id列表。输出格式对于输入接受id列表的其他命令非常有用。 搜索表达式可以是来自calibre强大的搜索查询语言中的任何内容,例如:calibredb searchauthor:asimov 'title:"i robot"'

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

返回的最大结果数。默认是所有结果。

FTS_INDEX

calibredb fts_index [options] enable/disable/status/reindex


控制全文检索索引进程。

启用此书库的全文索引
关闭此书库的全文索引
显示当前索引的状态
可用于重新索引特定书籍或 整个书库。要重新索引特定书籍 请在reindex命令后将书籍id指定为


附加参数。如果未指定书籍id,则会重新
索引整个书库。


每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

索引的速度。使用fast可使用所有计算机资源进行快速索引,使用slow可使用较少的资源进行索引。请注意,每次调用索引后,索引速度都会重置为slow。

等待所有书籍都编入索引,定期显示索引进度

FTS_SEARCH

calibredb fts_search [options]  search expression


对整个书库或其子集进行全文检索。

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

只匹配精确的字词而不是相关的字词。因此,correction将与orrecting不匹配。

包括每个匹配项相关的文本片段。请注意,这会使搜索速度慢得多。

允许搜索前必须索引多少书库,以百分比表示。默认为90

用于标示文本段内匹配单词的结尾的标记

用于标示文本段内匹配单词的开头的标记

--output-format
输出搜索结果的格式。纯文本为“text”,JSON输出为“json”。

使用搜索表达式或id限制搜索的书籍。例如:ids:1,2,3表示按id限制,或search:tag:foo表示限制具有标签foo的书籍。

NOTES

calibredb notes [options] [list|search|show|set|remove]


Manage the notes attached to items such as authors, series, tags and publishers. FIELD is the lookup name of the field, for example: authors, series, tags, publisher or #mycolumn. ITEM is the name of the item, for example the name of an author. Items are matched case insensitively.

List the items that have notes, optionally only those in the specified field. This is the default action:

calibredb notes list [FIELD]

Search the text of notes using the same SQLite full text search syntax as the Browse notes tool in calibre. Print the field, item name and an excerpt for each match. Use --field to search only the notes in a particular field:

calibredb notes search "search expression" calibredb notes search --field authors "search expression"

Print the note for an item as Markdown formatted text, or with --as-html as an HTML document with any images embedded, suitable for use with set:

calibredb notes show FIELD ITEM

Replace the note for an item with the contents of an HTML file. Use - to read the HTML from standard input. Images embedded as base64-encoded data: URLs are added to the note for both local and remote libraries. When using a local library and reading from a file, images referenced by paths relative to the file are added as well:

calibredb notes set FIELD ITEM FILE

Remove the note for an item:

calibredb notes remove FIELD ITEM

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

When showing a note, output it as HTML instead of Markdown formatted text

When searching notes, restrict the search to this field, for example: authors, tags or #mycolumn

ITEMS

calibredb items [options] (rename|remove) FIELD ITEM ...


Rename or remove items such as authors, tags, series and publishers in all books, the same as the Manage authors, tags, etc. actions in the calibre interface. FIELD is the lookup name of the field, for example: authors, tags, series, publisher or #mycolumn. Items are matched case insensitively.

Rename an item. If an item named NEW_NAME already exists, the two items are merged. For fields that contain multiple values, NEW_NAME can contain more than one value, separated by the separator for the field, for example a comma for tags. The item is then replaced by all the values:

calibredb items rename FIELD ITEM NEW_NAME

Remove one or more items from all books. Authors cannot be removed:

calibredb items remove FIELD ITEM [ITEM ...]

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

Only change books that match the specified search expression, for example: tags:"=Fiction"

VIRTUAL_LIBRARIES

calibredb virtual_libraries [options] [list|add|rename|remove]


Manage the Virtual libraries of this library. A Virtual library is a search that behaves as though the library contains only the books it matches. To list or search the books in a Virtual library, use: calibredb search 'vl:"name"'

List the Virtual libraries, with their searches and number of books. This is the default action:

calibredb virtual_libraries list

Create a Virtual library from a search:

calibredb virtual_libraries add name search_expression

Rename a Virtual library:

calibredb virtual_libraries rename name new_name

Remove Virtual libraries, the books in them are not changed:

calibredb virtual_libraries remove name ...

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

Generate output in JSON format, which is more suitable for machine parsing

Replace the search of an existing Virtual library with the same name when adding

ANNOTATIONS

calibredb annotations [options] [list|search|export|import|remove]


Manage the annotations, that is the highlights and bookmarks, of books, as created in the calibre E-book viewer or synced from other applications.

List the annotations, with their ids. This is the default action:

calibredb annotations list

Search highlighted text, annotation notes and bookmark titles using the same SQLite full text search syntax as the Browse annotations tool. Results are ordered by relevance and include annotation ids, book titles and matching excerpts. Use --search to restrict the books, --type to restrict the annotation type, --user-type and --annotation-user to restrict the user, --no-stemming to match exact word forms, or --format json for a JSON array of results including the annotation data and excerpts:

calibredb annotations search "search expression"

Export the annotations as plain text, Markdown or JSON, grouped by book. The JSON is the same calibre annotation collection as created by the Export button in the Browse annotations tool:

calibredb annotations export

Import a calibre annotation collection exported as JSON by this command or the Browse annotations tool. The collection must contain annotations from only one book. BOOK_ID is the destination book id, not the id stored in the file. Only the annotations of the format FORMAT are imported, annotations of other formats are skipped. FORMAT must exist in the destination book. Use the same edition of the book so positions match:

calibredb annotations import BOOK_ID FORMAT FILE

Use - for FILE to read from standard input. The entire collection is validated before importing. Annotations are merged with existing ones using the viewer's rules: highlights are matched by UUID and bookmarks by title, and the newer timestamp wins. Repeated imports do not create duplicates. Unrelated annotations and reading positions are preserved.

By default annotations are imported into those of the calibre E-book viewer. Use --user-type web --annotation-user USER to import them into those of a Content server user instead. Exported collections record the user the annotations belong to, and if a collection contains annotations of more than one user, it is rejected. Use the --user-type and --annotation-user options when exporting, to export the annotations of a single user.

Permanently remove the annotations with the specified ids, as shown by list:

calibredb annotations remove ID ...

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

Only list, search or export the annotations of the specified user. For import, the Content server user to import the annotations for, required with --user-type web. Note that this can be any user, not just the one used to connect to a remote library.

The export format, one of: text, markdown, json. For search, text or json. Default is: text

For search, match exact word forms instead of word stems

Only list, search or export the annotations of books matching the specified book search query, for example: --search "series:Foundation"

Only list, search or export annotations of the specified type, one of: highlight, bookmark

Only list, search or export the annotations of the specified type of user. For import, the type of user to import the annotations for, the calibre E-book viewer (local) or a Content server user (web). Default for import is local.

TRASH

calibredb trash [options] (list|restore|delete|empty) [ids]


Manage the books and formats that have been removed and placed in the trash bin. Entries in the trash bin are permanently deleted automatically after some days. ids is a comma separated list of book ids, as for the remove command, for example: 23,34,57-85 (when specifying a range, the last number in the range is not included).

List the removed books and formats, most recently removed first, with the times they were removed in local time. Removed formats of books that no longer exist are marked as not restorable, they can only be deleted. With --for-machine, the times are in UTC:

calibredb trash list

Restore removed books, or with --formats, the removed formats of books:

calibredb trash restore ids

Permanently delete entries from the trash bin:

calibredb trash delete ids

Permanently delete everything in the trash bin:

calibredb trash empty

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

Generate output for the list action in JSON format, which is more suitable for machine parsing

Act on the removed formats of the specified books, instead of on removed books

DATA_FILES

calibredb data_files [options] (list|add|get|rename|remove) BOOK_ID ...


Manage the extra data files associated with a book, in local or remote libraries. Names are relative to the book's data directory. Use / for subdirectories, is also accepted. Files whose names contain a are listed, but cannot otherwise be managed. E-book formats, covers and metadata.opf cannot be accessed with this command. Remote libraries require an account with write access, as for other management commands, and do not support accounts with per-library search restrictions.

List file names, sizes in bytes and modification times (seconds since the Unix epoch). Use --for-machine for JSON output:

calibredb data_files list BOOK_ID

Add a file, using its basename, or --name to specify a name or subdirectory. Existing files are not replaced unless --replace is specified. This is also available through add_format --as-extra-data-file:

calibredb data_files add BOOK_ID FILE

Save one data file to --output on the local machine. Existing output files are not replaced unless --replace is specified:

calibredb data_files get BOOK_ID NAME --output FILE

Rename a file. Existing destinations are not replaced unless --replace is set:

calibredb data_files rename BOOK_ID NAME NEW_NAME

Remove a file to the operating system's recycle bin. With --permanent, delete it permanently instead. For remote libraries this happens on the server:

calibredb data_files remove BOOK_ID NAME

Directories left empty by rename and remove are deleted. With remote libraries, each file is transferred in a single request, so very large files need enough memory on both the client and the server, and uploads are limited by the maximum request size of the server.

每当您将包含空格的参数传递给%p程序时,请将参数放在引号中。例如: "/some path/with spaces"

Output the list of files as JSON

Name to use for the added file, relative to the data directory

Local destination for the get action

Permanently delete the data file instead of using the recycle bin

Allow replacing existing files when adding, getting or renaming

Author

Kovid Goyal

Copyright

Kovid Goyal

十一月 06, 2026 9.18.0